The patch titled Subject: mm-fix-null-ptr-deref-in-kswapd_is_running-fix has been added to the -mm mm-unstable branch. Its filename is mm-fix-null-ptr-deref-in-kswapd_is_running-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-fix-null-ptr-deref-in-kswapd_is_running-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Subject: mm-fix-null-ptr-deref-in-kswapd_is_running-fix Date: Sat Aug 27 03:04:21 PM PDT 2022 add comments Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> Cc: Muchun Song <muchun.song@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/memory_hotplug.h | 1 + mm/compaction.c | 6 ++++++ 2 files changed, 7 insertions(+) --- a/include/linux/memory_hotplug.h~mm-fix-null-ptr-deref-in-kswapd_is_running-fix +++ a/include/linux/memory_hotplug.h @@ -215,6 +215,7 @@ void put_online_mems(void); void mem_hotplug_begin(void); void mem_hotplug_done(void); +/* See kswapd_is_running() */ static inline void pgdat_kswapd_lock(pg_data_t *pgdat) { mutex_lock(&pgdat->kswapd_lock); --- a/mm/compaction.c~mm-fix-null-ptr-deref-in-kswapd_is_running-fix +++ a/mm/compaction.c @@ -1980,6 +1980,12 @@ static inline bool is_via_compact_memory return order == -1; } +/* + * Determine whether kswapd is (or recently was!) running on this node. + * + * pgdat_kswapd_lock() pins pgdat->kswapd, so a concurrent kswapd_stop() can't + * zero it. + */ static bool kswapd_is_running(pg_data_t *pgdat) { bool running; _ Patches currently in -mm which might be from akpm@xxxxxxxxxxxxxxxxxxxx are asm-generic-sections-refactor-memory_intersects-fix.patch mm-page_alloc-fix-race-condition-between-build_all_zonelists-and-page-allocation-fix.patch procfs-add-path-to-proc-pid-fdinfo-fix.patch zsmalloc-zs_object_copy-add-clarifying-comment-fix.patch mm-gupc-simplify-and-fix-check_and_migrate_movable_pages-return-codes-fix-fix.patch mm-oom_kill-add-trace-logs-in-process_mrelease-system-call-fix.patch zsmalloc-zs_object_copy-replace-email-link-to-doc-checkpatch-fixes.patch mm-demotion-add-support-for-explicit-memory-tiers-fix.patch mm-demotion-update-node_is_toptier-to-work-with-memory-tiers-fix-2.patch mm-drop-oom-code-from-exit_mmap-fix-fix.patch mm-delete-unused-mmf_oom_victim-flag-vs-mglru.patch mm-add-merging-after-mremap-resize-checkpatch-fixes.patch mm-gupc-refactor-check_and_migrate_movable_pages-fix.patch mm-reduce-noise-in-show_mem-for-lowmem-allocations-vs-mapletree.patch page_ext-introduce-boot-parameter-early_page_ext-fix.patch mm-fix-null-ptr-deref-in-kswapd_is_running-fix.patch ia64-fix-clock_getresclock_monotonic-to-report-itc-frequency-checkpatch-fixes.patch