================================================================== BUG: KCSAN: data-race in __count_memcg_events / mem_cgroup_css_rstat_flush write to 0xffffe8ffffc57480 of 4 bytes by task 26277 on cpu 1: mem_cgroup_css_rstat_flush+0x4ea/0x540 mm/memcontrol.c:5848 cgroup_rstat_flush_locked+0x848/0x980 kernel/cgroup/rstat.c:245 cgroup_rstat_flush+0x26/0x40 kernel/cgroup/rstat.c:277 do_flush_stats mm/memcontrol.c:745 [inline] mem_cgroup_flush_stats+0xb2/0xc0 mm/memcontrol.c:766 prepare_scan_control mm/vmscan.c:2234 [inline] shrink_node+0x2f2/0x15a0 mm/vmscan.c:5906 shrink_zones mm/vmscan.c:6152 [inline] do_try_to_free_pages+0x3cc/0xca0 mm/vmscan.c:6214 try_to_free_mem_cgroup_pages+0x1eb/0x4e0 mm/vmscan.c:6529 try_charge_memcg+0x279/0xd10 mm/memcontrol.c:2783 try_charge mm/memcontrol.c:2931 [inline] charge_memcg mm/memcontrol.c:7284 [inline] mem_cgroup_swapin_charge_folio+0x107/0x1a0 mm/memcontrol.c:7369 __read_swap_cache_async+0x2b9/0x520 mm/swap_state.c:514 swap_cluster_readahead+0x276/0x3f0 mm/swap_state.c:678 swapin_readahead+0xe2/0x7a0 mm/swap_state.c:904 do_swap_page+0x3bb/0x15f0 mm/memory.c:4048 handle_pte_fault mm/memory.c:5303 [inline] __handle_mm_fault mm/memory.c:5441 [inline] handle_mm_fault+0x7fa/0x27e0 mm/memory.c:5606 do_user_addr_fault arch/x86/mm/fault.c:1331 [inline] handle_page_fault arch/x86/mm/fault.c:1474 [inline] exc_page_fault+0x3eb/0x690 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 read-write to 0xffffe8ffffc57480 of 4 bytes by task 27080 on cpu 0: memcg_rstat_updated mm/memcontrol.c:725 [inline] __count_memcg_events+0xce/0x130 mm/memcontrol.c:962 count_memcg_events include/linux/memcontrol.h:1096 [inline] count_memcg_folio_events include/linux/memcontrol.h:1106 [inline] shrink_folio_list+0xc72/0x2460 mm/vmscan.c:1451 shrink_inactive_list mm/vmscan.c:1926 [inline] shrink_list mm/vmscan.c:2163 [inline] shrink_lruvec+0xbbc/0x1640 mm/vmscan.c:5687 shrink_node_memcgs mm/vmscan.c:5873 [inline] shrink_node+0xa78/0x15a0 mm/vmscan.c:5908 shrink_zones mm/vmscan.c:6152 [inline] do_try_to_free_pages+0x3cc/0xca0 mm/vmscan.c:6214 try_to_free_mem_cgroup_pages+0x1eb/0x4e0 mm/vmscan.c:6529 try_charge_memcg+0x279/0xd10 mm/memcontrol.c:2783 try_charge mm/memcontrol.c:2931 [inline] charge_memcg mm/memcontrol.c:7284 [inline] mem_cgroup_swapin_charge_folio+0x107/0x1a0 mm/memcontrol.c:7369 __read_swap_cache_async+0x2b9/0x520 mm/swap_state.c:514 swap_cluster_readahead+0x276/0x3f0 mm/swap_state.c:678 swapin_readahead+0xe2/0x7a0 mm/swap_state.c:904 do_swap_page+0x3bb/0x15f0 mm/memory.c:4048 handle_pte_fault mm/memory.c:5303 [inline] __handle_mm_fault mm/memory.c:5441 [inline] handle_mm_fault+0x7fa/0x27e0 mm/memory.c:5606 do_user_addr_fault arch/x86/mm/fault.c:1331 [inline] handle_page_fault arch/x86/mm/fault.c:1474 [inline] exc_page_fault+0x3eb/0x690 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 value changed: 0x00000001 -> 0x00000000 Reported by Kernel Concurrency Sanitizer on: CPU: 0 PID: 27080 Comm: syz-executor.0 Not tainted 6.9.0-rc7-syzkaller-00023-g6d7ddd805123 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 ================================================================== syz-executor.0 invoked oom-killer: gfp_mask=0x100cca(GFP_HIGHUSER_MOVABLE), order=0, oom_score_adj=1000 CPU: 0 PID: 27080 Comm: syz-executor.0 Not tainted 6.9.0-rc7-syzkaller-00023-g6d7ddd805123 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xf2/0x150 lib/dump_stack.c:114 dump_stack+0x15/0x20 lib/dump_stack.c:123 dump_header+0x83/0x2d0 mm/oom_kill.c:462 oom_kill_process+0x33e/0x4c0 mm/oom_kill.c:1036 out_of_memory+0x9cb/0xc00 mm/oom_kill.c:1174 mem_cgroup_out_of_memory+0x13e/0x190 mm/memcontrol.c:1817 mem_cgroup_oom mm/memcontrol.c:2047 [inline] try_charge_memcg+0x752/0xd10 mm/memcontrol.c:2831 try_charge mm/memcontrol.c:2931 [inline] charge_memcg mm/memcontrol.c:7284 [inline] mem_cgroup_swapin_charge_folio+0x107/0x1a0 mm/memcontrol.c:7369 __read_swap_cache_async+0x2b9/0x520 mm/swap_state.c:514 swap_cluster_readahead+0x276/0x3f0 mm/swap_state.c:678 swapin_readahead+0xe2/0x7a0 mm/swap_state.c:904 do_swap_page+0x3bb/0x15f0 mm/memory.c:4048 handle_pte_fault mm/memory.c:5303 [inline] __handle_mm_fault mm/memory.c:5441 [inline] handle_mm_fault+0x7fa/0x27e0 mm/memory.c:5606 do_user_addr_fault arch/x86/mm/fault.c:1331 [inline] handle_page_fault arch/x86/mm/fault.c:1474 [inline] exc_page_fault+0x3eb/0x690 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 RIP: 0033:0x7f42491ead84 Code: 69 3d 34 d9 c9 00 e8 03 00 00 48 8d 1d 15 42 17 00 e8 80 5f 04 00 eb 12 66 0f 1f 44 00 00 48 81 c3 d0 00 00 00 48 39 eb 74 bb <80> 7b 20 00 74 ee 8b 43 0c 85 c0 74 e7 48 89 df e8 47 f0 ff ff eb RSP: 002b:00007ffd716d70d0 EFLAGS: 00010202 RAX: 0000000000000000 RBX: 00007f424935ef80 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000555565b82788 RBP: 00007f4249360980 R08: 0000000000000000 R09: 00007f424933d0b0 R10: 0000000000000000 R11: 0000000000000293 R12: 00000000000af5bf R13: 00007f424935ef8c R14: 00007ffd716d71b0 R15: 0000000000000032 memory: usage 307200kB, limit 307200kB, failcnt 7137 memory+swap: usage 307708kB, limit 9007199254740988kB, failcnt 0 kmem: usage 307188kB, limit 9007199254740988kB, failcnt 0 Memory cgroup stats for /syz0: cache 8192 rss 0 shmem 0 mapped_file 0 dirty 0 writeback 0 workingset_refault_anon 38 workingset_refault_file 6 swap 520192 swapcached 4096 pgpgin 376461 pgpgout 376458 pgfault 496609 pgmajfault 82 inactive_anon 4096 active_anon 0 inactive_file 8192 active_file 0 unevictable 0 hierarchical_memory_limit 314572800 hierarchical_memsw_limit 9223372036854771712 total_cache 8192 total_rss 0 total_shmem 0 total_mapped_file 0 total_dirty 0 total_writeback 0 total_workingset_refault_anon 38 total_workingset_refault_file 6 total_swap 520192 total_swapcached 4096 total_pgpgin 376461 total_pgpgout 376458 total_pgfault 496614 total_pgmajfault 82 total_inactive_anon 4096 total_active_anon 0 total_inactive_file 8192 total_active_file 0 total_unevictable 0 oom-kill:constraint=CONSTRAINT_MEMCG,nodemask=(null),cpuset=syz0,mems_allowed=0,oom_memcg=/syz0,task_memcg=/syz0,task=syz-executor.0,pid=27080,uid=0 Memory cgroup out of memory: Killed process 27080 (syz-executor.0) total-vm:48392kB, anon-rss:384kB, file-rss:8960kB, shmem-rss:0kB, UID:0 pgtables:84kB oom_score_adj:1000