Thread (1 message) 1 message, 1 author, 2024-01-08

Re: [PATCH v5 02/11] mm/mempolicy: introduce MPOL_WEIGHTED_INTERLEAVE for weighted interleaving

From: Huang, Ying <hidden>
Date: 2024-01-08 07:10:10
Also in: linux-doc, linux-fsdevel, linux-mm, lkml

Gregory Price [off-list ref] writes:
On Fri, Jan 05, 2024 at 02:51:40PM +0800, Huang, Ying wrote:
quoted
quoted
So we're talking ~1MB for 1024 threads with mempolicies to avoid error
conditions mid-page-allocation and to reduce the cost associated with
applying weighted interleave.
Think about this again.  Why do we need weights array on stack?  I think
this is used to keep weights consistent.  If so, we don't need weights
array on stack.  Just use RCU to access global weights array.
From the bulk allocation code:

__alloc_pages_bulk(gfp, node, NULL, node_pages, NULL, page_array);

This function can block. You cannot block during an RCU read context.
Yes.  You are right.  For __alloc_pages_bulk(), it should be OK to
allocate the weights array.  For weighted_interleave_nid(), we can use
RCU to avoid memory allocation in relative fast code path.

BTW, we can use nr_node_ids instead of MAX_NUMNODES if applicable.

--
Best Regards,
Huang, Ying
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help