[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZdfHi142dvQuN7B-@localhost.localdomain>
Date: Thu, 22 Feb 2024 23:15:39 +0100
From: Oscar Salvador <osalvador@...e.de>
To: Baolin Wang <baolin.wang@...ux.alibaba.com>
Cc: akpm@...ux-foundation.org, muchun.song@...ux.dev, david@...hat.com,
linmiaohe@...wei.com, naoya.horiguchi@....com, mhocko@...nel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 2/3] mm: hugetlb: make the hugetlb migration strategy
consistent
On Wed, Feb 21, 2024 at 05:27:54PM +0800, Baolin Wang wrote:
> Based on the analysis of the various scenarios above, determine whether fallback is
> permitted according to the migration reason in alloc_hugetlb_folio_nodemask().
Hi Baolin,
The high level reasoning makes sense to me, taking a step back and
thinking about all cases and possible outcomes makes sense to me.
I plan to look closer, but I something that caught my eye:
> }
> spin_unlock_irq(&hugetlb_lock);
>
> + if (gfp_mask & __GFP_THISNODE)
> + goto alloc_new;
> +
> + /*
> + * Note: the memory offline, memory failure and migration syscalls can break
> + * the per-node hugetlb pool. Other cases can not allocate new hugetlb on
> + * other nodes.
> + */
> + switch (reason) {
> + case MR_MEMORY_HOTPLUG:
> + case MR_MEMORY_FAILURE:
> + case MR_SYSCALL:
> + case MR_MEMPOLICY_MBIND:
> + allowed_fallback = true;
> + break;
> + default:
> + break;
> + }
> +
> + if (!allowed_fallback)
> + gfp_mask |= __GFP_THISNODE;
I think it would be better if instead of fiddling with gfp here,
have htlb_alloc_mask() have a second argument with the MR_reason,
do the switch there and enable GFP_THISNODE.
Then alloc_hugetlb_folio_nodemask() would already get the right mask.
I think that that might be more clear as it gets encapsulated in the
function that directly gives us the gfp.
Does that makes sense?
--
Oscar Salvador
SUSE Labs
Powered by blists - more mailing lists