Re: [PATCH] mm/mempolicy: Fix sleeping allocation in alloc_pages_bulk_weighted_interleave()
From: Gregory Price
Date: Sun Aug 23 2026 - 19:01:49 EST
On Fri, Aug 21, 2026 at 10:40:43AM -0700, Andrew Morton wrote:
> > --- a/mm/mempolicy.c
> > +++ b/mm/mempolicy.c
> > @@ -2688,7 +2688,7 @@ static unsigned long alloc_pages_bulk_weighted_interleave(gfp_t gfp,
> > prev_node = node;
> >
> > /* create a local copy of node weights to operate on outside rcu */
> > - weights = kzalloc(nr_node_ids, GFP_KERNEL);
> > + weights = kmalloc(nr_node_ids, gfp & GFP_RECLAIM_MASK);
>
> I wonder if we *really* need the local copy of state->iw_table.
> Perhaps with appropriate care we can directly use state->iw_table in
> here.
>
> How much would it hurt to expand the rcu_read_lock() coverage?
>
Ah, the current space we'd expand rcu read lock into is the actual
allocation - which we can't do. Same with the spinlock.
We can clean this up with a refcount + rcu_free and kill the allocation
in the hot path. Will get something out this week.
~Gregory