Yu Zhao
baeb9a0025
BACKPORT: mm: multi-gen LRU: kill switch
Add /sys/kernel/mm/lru_gen/enabled as a kill switch. Components that
can be disabled include:
0x0001: the multi-gen LRU core
0x0002: walking page table, when arch_has_hw_pte_young() returns
true
0x0004: clearing the accessed bit in non-leaf PMD entries, when
CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG=y
[yYnN]: apply to all the components above
E.g.,
echo y >/sys/kernel/mm/lru_gen/enabled
cat /sys/kernel/mm/lru_gen/enabled
0x0007
echo 5 >/sys/kernel/mm/lru_gen/enabled
cat /sys/kernel/mm/lru_gen/enabled
0x0005
NB: the page table walks happen on the scale of seconds under heavy memory
pressure, in which case the mmap_lock contention is a lesser concern,
compared with the LRU lock contention and the I/O congestion. So far the
only well-known case of the mmap_lock contention happens on Android, due
to Scudo [1] which allocates several thousand VMAs for merely a few
hundred MBs. The SPF and the Maple Tree also have provided their own
assessments [2][3]. However, if walking page tables does worsen the
mmap_lock contention, the kill switch can be used to disable it. In this
case the multi-gen LRU will suffer a minor performance degradation, as
shown previously.
Clearing the accessed bit in non-leaf PMD entries can also be disabled,
since this behavior was not tested on x86 varieties other than Intel and
AMD.
[1] https://source.android.com/devices/tech/debug/scudo
[2] https://lore.kernel.org/r/20220128131006.67712-1-michel@lespinasse.org/
[3] https://lore.kernel.org/r/20220426150616.3937571-1-Liam.Howlett@oracle.com/
Link: https://lkml.kernel.org/r/20220918080010.2920238-11-yuzhao@google.com
Change-Id: If3116e6698cc6967b6992c2017962fac6c2d3a11
Signed-off-by: Yu Zhao <yuzhao@google.com>
Acked-by: Brian Geffon <bgeffon@google.com>
Acked-by: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
Acked-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Acked-by: Steven Barrett <steven@liquorix.net>
Acked-by: Suleiman Souhlal <suleiman@google.com>
Tested-by: Daniel Byrne <djbyrne@mtu.edu>
Tested-by: Donald Carr <d@chaos-reins.com>
Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Tested-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Tested-by: Shuang Zhai <szhai2@cs.rochester.edu>
Tested-by: Sofia Trinh <sofia.trinh@edi.works>
Tested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Hillf Danton <hdanton@sina.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Michael Larabel <Michael@MichaelLarabel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 354ed597442952fb680c9cafc7e4eb8a76f9514c)
Bug: 249601646
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2022-11-30 00:28:11 +00:00
..
2022-11-28 16:08:50 +00:00
2022-11-30 00:28:11 +00:00
2021-05-07 00:26:34 -07:00
2022-05-25 09:57:37 +02:00
2022-10-05 11:59:55 +02:00
2022-09-20 12:39:42 +02:00
2022-11-28 16:08:50 +00:00
2022-10-26 12:35:56 +02:00
2022-09-21 17:30:12 +02:00
2021-09-02 13:00:15 -07:00
2022-10-26 12:34:30 +02:00
2022-09-24 14:14:08 +02:00
2022-11-15 12:48:44 +00:00
2022-07-13 11:40:42 +02:00
2022-11-02 08:51:19 +01:00
2022-11-30 00:28:11 +00:00
2022-09-21 17:30:12 +02:00
2022-11-28 16:08:50 +00:00
2022-04-27 15:34:29 +00:00
2021-09-08 11:50:26 -07:00
2022-02-23 12:03:07 +01:00
2022-08-31 17:16:33 +02:00
2021-08-24 18:52:36 -04:00
2022-02-08 18:34:03 +01:00
2022-04-08 14:23:06 +02:00
2021-03-22 15:23:32 -04:00
2022-04-08 14:23:06 +02:00
2022-11-30 00:28:11 +00:00
2022-11-14 22:32:51 +00:00
2021-09-08 15:32:35 -07:00
2021-08-16 18:55:32 +02:00
2022-06-14 11:49:05 +02:00
2021-12-29 12:28:49 +01:00
2022-02-23 12:30:26 +01:00
2021-05-12 11:43:25 +02:00
2022-11-30 00:28:11 +00:00
2022-11-30 00:28:11 +00:00
2022-02-10 09:29:57 +00:00
2021-09-16 09:51:19 +02:00
2022-07-14 22:20:19 +00:00
2022-09-30 17:41:39 +00:00
2022-02-10 09:29:34 +00:00
2021-06-13 15:19:53 +02:00
2021-07-05 10:46:20 +02:00
2021-07-08 11:48:22 -07:00
2021-08-17 17:50:51 +02:00
2021-06-28 22:43:05 +02:00
2021-08-30 16:36:10 +02:00
2022-07-21 21:24:29 +02:00
2021-09-08 15:32:34 -07:00
2021-05-07 00:26:33 -07:00
2022-11-26 09:24:50 +01:00
2021-07-12 10:02:27 +01:00
2022-11-14 22:32:51 +00:00
2022-09-30 17:41:39 +00:00
2022-09-30 17:41:39 +00:00
2021-08-16 18:55:32 +02:00
2021-09-03 09:58:12 -07:00
2021-08-27 16:30:18 +08:00
2021-08-30 16:36:10 +02:00
2021-08-16 14:42:22 +02:00
2021-09-03 09:58:12 -07:00
2021-09-02 09:42:36 +02:00
2022-08-17 14:24:04 +02:00
2022-06-09 10:22:29 +02:00
2021-09-28 08:49:54 -07:00
2022-04-08 14:23:43 +02:00
2022-04-08 14:23:10 +02:00
2022-06-09 10:22:46 +02:00
2022-03-21 15:31:19 +00:00
2022-02-16 12:56:38 +01:00
2022-07-22 17:43:50 +02:00
2022-08-17 14:24:24 +02:00
2021-08-10 14:57:42 +02:00
2021-11-11 18:55:19 +00:00
2022-02-23 12:03:07 +01:00
2022-04-24 16:57:32 +02:00
2022-04-13 20:59:28 +02:00
2022-04-13 20:59:28 +02:00
2021-11-09 00:42:10 +00:00
2022-08-31 17:16:33 +02:00
2022-08-10 08:58:11 +01:00
2021-06-23 16:41:24 -06:00
2022-08-02 08:37:15 +02:00
2021-04-30 11:20:42 -07:00
2021-08-10 10:48:07 -07:00
2021-09-14 16:16:54 +02:00
2022-01-27 11:05:35 +01:00
2022-02-23 12:03:20 +01:00
2022-07-19 03:54:51 +00:00
2021-05-09 13:07:03 -07:00
2022-03-08 19:12:42 +01:00
2021-09-08 11:50:27 -07:00
2021-07-03 11:41:14 -07:00
2022-08-03 12:03:43 +02:00
2022-09-24 10:01:09 +02:00
2021-08-17 07:49:10 -10:00
2022-09-28 13:32:32 +02:00