You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mm/memcontrol: Fix LRU reparenting logic when !MGLRU
The Multi-Gen LRU (MGLRU) is enabled by default via
CONFIG_LRU_GEN_ENABLED=y, but it can be dynamically disabled by writing
n to /sys/kernel/mm/lru_gen/enabled. While attempting to disable the
MGLRU and switching over to the classic LRU (anon/file), the following
crash is seen:
>> trace
#0 crash_setup_regs (./arch/x86/include/asm/kexec.h:111:15)
#1 __crash_kexec (kernel/crash_core.c:122:4)
#2 panic (kernel/panic.c:399:3)
#3 oops_end (arch/x86/kernel/dumpstack.c:382:3)
#4 do_trap_no_signal (arch/x86/kernel/traps.c:156:3)
#5 do_trap (arch/x86/kernel/traps.c:197:7)
#6 do_error_trap (arch/x86/kernel/traps.c:217:3)
#7 handle_invalid_op (arch/x86/kernel/traps.c:254:2)
#8 exc_invalid_op (arch/x86/kernel/traps.c:314:2)
#9 asm_exc_invalid_op+0x1a/0x1f (./arch/x86/include/asm/idtentry.h:621)
#10 __list_del_entry_valid_or_report (lib/list_debug.c:62:6)
#11 __list_del_entry_valid (./include/linux/list.h:124:9)
#12 __list_del_entry (./include/linux/list.h:215:7)
#13 list_del (./include/linux/list.h:229:2)
#14 lruvec_del_folio (./include/linux/mm_inline.h:361:3)
#15 lru_activate (mm/swap.c:342:2)
#16 folio_batch_move_lru (mm/swap.c:199:3)
#17 lru_add_drain (mm/swap.c:734:2)
#18 wp_can_reuse_anon_folio (mm/memory.c:3788:3)
#19 do_wp_page (mm/memory.c:3900:39)
#20 __handle_mm_fault (mm/memory.c:6090:9)
#21 handle_mm_fault (mm/memory.c:6258:9)
#22 do_user_addr_fault (arch/x86/mm/fault.c:1338:10)
#23 handle_page_fault (arch/x86/mm/fault.c:1481:3)
#24 exc_page_fault (arch/x86/mm/fault.c:1539:2)
#25 asm_exc_page_fault+0x26/0x2b (./arch/x86/include/asm/idtentry.h:623)
#26 0x7f82f0896ed2
The issue occurs because the MGLRU-specific version of
lruvec_reparent_relocate() is invoked even when the system is using the
classic LRU. Fix this, by ensuring the call is properly gated by
lru_gen_enabled(), which checks whether MGLRU is enabled either
statically via Kconfig or dynamically via the /sys interface.
Orabug: 37920452
Fixes: cc65a5d ("mm: memcontrol: use obj_cgroup APIs to charge the LRU pages")
Cc: Tom Hromatka <[email protected]>
Reported-by: Sidhartha Kumar <[email protected]>
Reviewed-by: Sidhartha Kumar <[email protected]>
Reviewed-by: Harry Yoo <[email protected]>
Tested-by: Harry Yoo <[email protected]>
Reviewed-by: Imran Khan <[email protected]>
Signed-off-by: Kamalesh Babulal <[email protected]>
Signed-off-by: Harry Yoo <[email protected]>
0 commit comments