Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The newly added `alloc_flags` parameter is ignored during the bulk allocation fastpath when calling `prep_new_page`.
--
--- Patch [3]: [PATCH v5 03/36] mm/page_alloc: let the bulk and folio allocators carry alloc_flags ---
commit 00718b17ea28c0a7382f9831d41a8a45df59e496
Author: Gregory Price <[email protected]>
mm/page_alloc: let the bulk and folio allocators carry alloc_flags
This commit threads the alloc_flags parameter through the bulk and folio
allocators to allow callers to select specific allocator behavior. It updates
__alloc_pages_bulk_noprof and __folio_alloc_noprof to accept and pass these
flags internally.
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
[ ... ]
> @@ -5238,11 +5239,19 @@ unsigned long alloc_pages_bulk_noprof(gfp_t gfp, int preferred_nid,
> return nr_populated;
>
> failed:
> - page = __alloc_pages_noprof(gfp, 0, preferred_nid, nodemask, ALLOC_DEFAULT);
> + page = __alloc_pages_noprof(gfp, 0, preferred_nid, nodemask, alloc_flags);
> if (page)
> page_array[nr_populated++] = page;
> goto out;
> }
[Severity: Medium]
Will the fast path ignore the caller's new alloc_flags parameter?
In the slow path fallback above, the code correctly passes the new alloc_flags
parameter to __alloc_pages_noprof(). However, in the fast path batch
allocation loop just above this hunk, the pages are still initialized with a
hardcoded ALLOC_DEFAULT:
__alloc_pages_bulk_noprof() {
...
while (nr_populated < nr_pages) {
...
page = __rmqueue_pcplist(...);
...
prep_new_page(page, 0, gfp, ALLOC_DEFAULT);
set_page_refcounted(page);
page_array[nr_populated++] = page;
}
}
If a caller passes custom alloc_flags to __alloc_pages_bulk_noprof(), it
appears the flags will be dropped by the fast path but honored by the slow
path, leading to inconsistent allocator behavior.
Should prep_new_page() in the fast path loop be updated to use the provided
alloc_flags instead of ALLOC_DEFAULT?
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.