* + mm-page_alloc-fix-alignment-for-alloc_contig_pages_noprof.patch added to mm-new branch
@ 2025-09-23 3:30 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-09-23 3:30 UTC (permalink / raw)
To: mm-commits, ziy, vbabka, surenb, osalvador, mhocko, jackmanb,
hannes, anshuman.khandual, richard.weiyang, akpm
The patch titled
Subject: mm/page_alloc: fix alignment for alloc_contig_pages_noprof()
has been added to the -mm mm-new branch. Its filename is
mm-page_alloc-fix-alignment-for-alloc_contig_pages_noprof.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-fix-alignment-for-alloc_contig_pages_noprof.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
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@gmail.com>
Subject: mm/page_alloc: fix alignment for alloc_contig_pages_noprof()
Date: Tue, 23 Sep 2025 00:19:43 +0000
Commit 5e27a2df03b8 ("mm/page_alloc: add alloc_contig_pages()") introduced
generic method for alloc_contig_pages(). But the alignment calculation
seems wrong.
Since ALIGN() only accepts power of two values, while nr_pages could be
any positive one, the result is not defined.
Use roundup() to calculate the correct alignment.
Link: https://lkml.kernel.org/r/20250923001943.2479-1-richard.weiyang@gmail.com
Fixes: 5e27a2df03b8 ("mm/page_alloc: add alloc_contig_pages()")
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/page_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/mm/page_alloc.c~mm-page_alloc-fix-alignment-for-alloc_contig_pages_noprof
+++ a/mm/page_alloc.c
@@ -7098,7 +7098,7 @@ struct page *alloc_contig_pages_noprof(u
gfp_zone(gfp_mask), nodemask) {
spin_lock_irqsave(&zone->lock, flags);
- pfn = ALIGN(zone->zone_start_pfn, nr_pages);
+ pfn = roundup(zone->zone_start_pfn, nr_pages);
while (zone_spans_last_pfn(zone, pfn, nr_pages)) {
if (pfn_range_valid_contig(zone, pfn, nr_pages)) {
/*
_
Patches currently in -mm which might be from richard.weiyang@gmail.com are
mm-compaction-fix-low_pfn-advance-on-isolating-hugetlb.patch
mm-ksm-get-mm_slot-by-mm_slot_entry-when-slot-is-null.patch
mm-khugepaged-remove-definition-of-struct-khugepaged_mm_slot.patch
mm-khugepaged-remove-definition-of-struct-khugepaged_mm_slot-fix.patch
mm-khugepaged-use-start_addr-addr-for-better-reading.patch
mm-page_alloc-fix-alignment-for-alloc_contig_pages_noprof.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-09-23 3:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-23 3:30 + mm-page_alloc-fix-alignment-for-alloc_contig_pages_noprof.patch added to mm-new branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.