[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <84380389-0922-4073-B4C7-DBF9F865E162@linux.dev>
Date: Mon, 22 Jan 2024 17:50:26 +0800
From: Muchun Song <muchun.song@...ux.dev>
To: Gang Li <gang.li@...ux.dev>
Cc: David Hildenbrand <david@...hat.com>,
David Rientjes <rientjes@...gle.com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Linux-MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
ligang.bdlg@...edance.com
Subject: Re: [PATCH v4 4/7] hugetlb: pass *next_nid_to_alloc directly to
for_each_node_mask_to_alloc
> On Jan 22, 2024, at 17:14, Gang Li <gang.li@...ux.dev> wrote:
>
> On 2024/1/22 14:16, Muchun Song wrote:
>> On 2024/1/18 20:39, Gang Li wrote:
>>> static struct folio *alloc_pool_huge_folio(struct hstate *h,
>>> nodemask_t *nodes_allowed,
>>> - nodemask_t *node_alloc_noretry)
>>> + nodemask_t *node_alloc_noretry,
>>> + int *next_node)
>>> {
>>> gfp_t gfp_mask = htlb_alloc_mask(h) | __GFP_THISNODE;
>>> int nr_nodes, node;
>>> - for_each_node_mask_to_alloc(h, nr_nodes, node, nodes_allowed) {
>>> + for_each_node_mask_to_alloc(next_node, nr_nodes, node, nodes_allowed) {
>> A small question here, why not pass h->next_nid_to_alloc to
>> for_each_node_mask_to_alloc()? What's the purpose of the third
>> parameter of alloc_pool_huge_folio()?
>> Thanks.
>
> In hugetlb_alloc_node->alloc_pool_huge_folio, hugetlb is initialized in
> parallel at boot time, then it needs each thread to have its own
> next_nid, and can't use the global h->next_nid_to_alloc. so an extra parameter is added.
Yes. When I read your patch 6, I realized this.
>
> And h->next_nid_to_alloc in set_max_huge_pages->alloc_pool_huge_folio
> can not be removed. Because if the user calls set_max_huge_pages
> frequently and only adds 1 page at a time, that would result in each
> request being made on the same node if local variables are used.
Powered by blists - more mailing lists