Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb5add32 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "lowmemorykiller: add zcache awareness"

parents b99ea11c 0f551af8
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@
#include <linux/fs.h>
#include <linux/cpuset.h>
#include <linux/vmpressure.h>
#include <linux/zcache.h>

#define CREATE_TRACE_POINTS
#include <trace/events/almk.h>
@@ -146,7 +147,7 @@ static int lmk_vmpressure_notifier(struct notifier_block *nb,
		return 0;

	if (pressure >= 95) {
		other_file = global_page_state(NR_FILE_PAGES) -
		other_file = global_page_state(NR_FILE_PAGES) + zcache_pages() -
			global_page_state(NR_SHMEM) -
			total_swapcache_pages();
		other_free = global_page_state(NR_FREE_PAGES);
@@ -159,7 +160,7 @@ static int lmk_vmpressure_notifier(struct notifier_block *nb,
		if (lowmem_minfree_size < array_size)
			array_size = lowmem_minfree_size;

		other_file = global_page_state(NR_FILE_PAGES) -
		other_file = global_page_state(NR_FILE_PAGES) + zcache_pages() -
			global_page_state(NR_SHMEM) -
			total_swapcache_pages();

@@ -398,8 +399,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
	other_free = global_page_state(NR_FREE_PAGES);

	if (global_page_state(NR_SHMEM) + total_swapcache_pages() <
		global_page_state(NR_FILE_PAGES))
		other_file = global_page_state(NR_FILE_PAGES) -
		global_page_state(NR_FILE_PAGES) + zcache_pages())
		other_file = global_page_state(NR_FILE_PAGES) + zcache_pages() -
						global_page_state(NR_SHMEM) -
						total_swapcache_pages();
	else
@@ -492,6 +493,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
				"   Total reserve is %ldkB\n" \
				"   Total free pages is %ldkB\n" \
				"   Total file cache is %ldkB\n" \
				"   Total zcache is %ldkB\n" \
				"   GFP mask is 0x%x\n",
			     selected->comm, selected->pid,
			     selected_oom_score_adj,
@@ -508,6 +510,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
				(long)(PAGE_SIZE / 1024),
			     global_page_state(NR_FILE_PAGES) *
				(long)(PAGE_SIZE / 1024),
			     (long)zcache_pages() * (long)(PAGE_SIZE / 1024),
			     sc->gfp_mask);

		if (lowmem_debug_level >= 2 && selected_oom_score_adj == 0) {

include/linux/zcache.h

0 → 100644
+22 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
#ifndef _LINUX_ZCACHE_H
#define _LINUX_ZCACHE_H

#ifdef CONFIG_ZCACHE
extern u64 zcache_pages(void);
#else
u64 zcache_pages(void) { return 0; }
#endif

#endif /* _LINUX_ZCACHE_H */
+5 −0
Original line number Diff line number Diff line
@@ -138,6 +138,11 @@ struct zcache_ra_handle {
	struct zcache_pool *zpool;	/* Finding zcache_pool during evict */
};

u64 zcache_pages(void)
{
	return zcache_pool_pages;
}

static struct kmem_cache *zcache_rbnode_cache;
static int zcache_rbnode_cache_create(void)
{