lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 28 Dec 2023 06:27:14 +0000
From: Haifeng Xu <haifeng.xu@...pee.com>
To: roman.gushchin@...ux.dev
Cc: akpm@...ux-foundation.org,
	hannes@...xchg.org,
	mhocko@...nel.org,
	shakeelb@...gle.com,
	linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	Haifeng Xu <haifeng.xu@...pee.com>
Subject: [PATCH 1/2] mm: list_lru: disable memcg_aware when cgroup.memory is set to "nokmem"

Actually, when using a boot time kernel option "cgroup.memory=nokmem",
all lru items are inserted to list_lru_node. But for those users who
invoke list_lru_init_memcg() to initialize list_lru, list_lru_memcg_aware()
returns true. And this brings unneeded operations related to memcg.

To make things more convenient, let's disable memcg_aware when
cgroup.memory is set to "nokmem".

Signed-off-by: Haifeng Xu <haifeng.xu@...pee.com>
---
 mm/list_lru.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/list_lru.c b/mm/list_lru.c
index a05e5bef3b40..86f63c92fd88 100644
--- a/mm/list_lru.c
+++ b/mm/list_lru.c
@@ -566,6 +566,9 @@ int __list_lru_init(struct list_lru *lru, bool memcg_aware,
 		lru->shrinker_id = shrinker->id;
 	else
 		lru->shrinker_id = -1;
+
+	if (mem_cgroup_kmem_disabled())
+		memcg_aware = false;
 #endif
 
 	lru->node = kcalloc(nr_node_ids, sizeof(*lru->node), GFP_KERNEL);
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ