The patch titled Subject: mm-page_alloc-remove-prefetchw-on-freeing-page-to-buddy-system-v2 has been added to the -mm mm-unstable branch. Its filename is mm-page_alloc-remove-prefetchw-on-freeing-page-to-buddy-system-v2.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-page_alloc-remove-prefetchw-on-freeing-page-to-buddy-system-v2.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: Wei Yang <richard.weiyang@xxxxxxxxx> Subject: mm-page_alloc-remove-prefetchw-on-freeing-page-to-buddy-system-v2 Date: Thu, 4 Jul 2024 01:59:06 +0000 slightly adjust the loop based on David's comment Link: https://lkml.kernel.org/r/20240704015906.18437-1-richard.weiyang@xxxxxxxxx Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx> Suggested-by: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/page_alloc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- a/mm/page_alloc.c~mm-page_alloc-remove-prefetchw-on-freeing-page-to-buddy-system-v2 +++ a/mm/page_alloc.c @@ -1224,7 +1224,7 @@ void __free_pages_core(struct page *page { unsigned int nr_pages = 1 << order; struct page *p = page; - unsigned int loop; + unsigned int loop = 0; /* * When initializing the memmap, __init_single_page() sets the refcount @@ -1236,10 +1236,13 @@ void __free_pages_core(struct page *page */ if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG) && unlikely(context == MEMINIT_HOTPLUG)) { - for (loop = 0; loop < nr_pages; loop++, p++) { + for (;;) { VM_WARN_ON_ONCE(PageReserved(p)); __ClearPageOffline(p); set_page_count(p, 0); + if (++loop >= nr_pages) + break; + p++; } /* @@ -1250,9 +1253,12 @@ void __free_pages_core(struct page *page debug_pagealloc_map_pages(page, nr_pages); adjust_managed_page_count(page, nr_pages); } else { - for (loop = 0; loop < nr_pages; loop++, p++) { + for (;;) { __ClearPageReserved(p); set_page_count(p, 0); + if (++loop >= nr_pages) + break; + p++; } /* memblock adjusts totalram_pages() manually. */ _ Patches currently in -mm which might be from richard.weiyang@xxxxxxxxx are kernel-forkc-get-totalram_pages-from-memblock-to-calculate-max_threads.patch kernel-forkc-put-set_max_threads-task_struct_whitelist-in-__init-section.patch mm-page_alloc-remove-prefetchw-on-freeing-page-to-buddy-system.patch mm-page_alloc-remove-prefetchw-on-freeing-page-to-buddy-system-v2.patch