linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Oscar Salvador <osalvador@suse.de>
Cc: akpm@linux-foundation.org, muchun.song@linux.dev,
	david@redhat.com, linmiaohe@huawei.com, naoya.horiguchi@nec.com,
	mhocko@kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] mm: hugetlb: make the hugetlb migration strategy consistent
Date: Wed, 6 Mar 2024 16:58:23 +0800	[thread overview]
Message-ID: <d45de441-ff6f-463b-97d1-49341852dd14@linux.alibaba.com> (raw)
In-Reply-To: <Zegta2FEb8pkV4vz@localhost.localdomain>



On 2024/3/6 16:46, Oscar Salvador wrote:
> On Wed, Mar 06, 2024 at 04:35:26PM +0800, Baolin Wang wrote:
>> On 2024/2/28 16:41, Oscar Salvador wrote:
> 
>>>    	if (folio_test_hugetlb(src)) {
>>>    		struct hstate *h = folio_hstate(src);
>>> +		bool allow_fallback = false;
>>> +
>>> +		if ((1UL << reason) & HTLB_ALLOW_FALLBACK)
>>> +			allow_fallback = true;
>>
>> IMHO, users also should not be aware of these hugetlb logics.
> 
> Note that what I wrote there was ugly, because it was just a PoC.
> 
> It could be a helper e.g:
> 
>   if (hugetlb_reason_allow_alloc_fallback(reason)) (or whatever)
>       allow_fallback_alloc = true
> 
>>>
>>>    		gfp_mask = htlb_modify_alloc_mask(h, gfp_mask);
>>>    		return alloc_hugetlb_folio_nodemask(h, nid,
>>> -						mtc->nmask, gfp_mask);
>>> +						mtc->nmask, gfp_mask,
>>> +						allow_fallback);
>>
>> 'allow_fallback' can be confusing, that means it is 'allow_fallback' for a
>> new temporary hugetlb allocation, but not 'allow_fallback' for an available
>> hugetlb allocation in alloc_hugetlb_folio_nodemask().
> 
> Well, you can pick "alloc_fallback_on_alloc" which is more descriptive I
> guess.

Seems better.

> 
> Bottomline line is that I do not think that choosing to allow
> fallbacking or not here is spreading more logic than having the
> htlb_modify_alloc_mask() here and not directly in
> alloc_hugetlb_folio_nodemask().
> 
> As I said, code-wise looks fine, it is just that having to pass
> the 'reason' all the way down and making the decision there makes
> me go "meh..".

Well, fair enough:) let me respin it. Thanks.


  reply	other threads:[~2024-03-06  8:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 13:52 [PATCH 0/3] make the hugetlb migration strategy consistent Baolin Wang
2024-02-27 13:52 ` [PATCH 1/3] mm: record the migration reason for struct migration_target_control Baolin Wang
2024-02-27 15:10   ` Oscar Salvador
2024-02-28  7:40     ` Baolin Wang
2024-02-27 13:52 ` [PATCH 2/3] mm: hugetlb: make the hugetlb migration strategy consistent Baolin Wang
2024-02-27 15:17   ` Oscar Salvador
2024-02-28  7:40     ` Baolin Wang
2024-02-28  8:41       ` Oscar Salvador
2024-03-06  8:35         ` Baolin Wang
2024-03-06  8:46           ` Oscar Salvador
2024-03-06  8:58             ` Baolin Wang [this message]
2024-02-27 13:52 ` [PATCH 3/3] docs: hugetlbpage.rst: add hugetlb migration description Baolin Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d45de441-ff6f-463b-97d1-49341852dd14@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=naoya.horiguchi@nec.com \
    --cc=osalvador@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).