linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Michal Hocko <mhocko@suse.com>, Li Xinhai <lixinhai.lxh@gmail.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
	Roman Gushchin <guro@fb.com>
Subject: Re: [PATCH V3] mm/hugetlb: try preferred node first when alloc gigantic page from cma
Date: Wed, 2 Sep 2020 11:07:02 -0700	[thread overview]
Message-ID: <c2474631-3ca6-5411-fd9d-73ffa28fb7ec@oracle.com> (raw)
In-Reply-To: <20200902061425.GB6363@dhcp22.suse.cz>

On 9/1/20 11:14 PM, Michal Hocko wrote:
> On Wed 02-09-20 10:50:16, Li Xinhai wrote:
>> Since commit cf11e85fc08cc6a4 ("mm: hugetlb: optionally allocate gigantic
>> hugepages using cma"), the gigantic page would be allocated from node
>> which is not the preferred node, although there are pages available from
>> that node. The reason is that the nid parameter has been ignored in
>> alloc_gigantic_page().
>>
>> Besides, the __GFP_THISNODE also need be checked if user required to
>> alloc only from the preferred node.
>>
>> After this patch, the preferred node is tried first before other allowed
>> nodes, and don't try to allocate from other nodes if __GFP_THISNODE is
>> specified. If user don't specify the preferred node, the current node
>> will be used as preferred node, which makes sure consistent behavior of
>> allocating gigantic and non-gigantic hugetlb page.
> 
> Technically speaking this is still not in full sync with the allocator
> semantic. E.g. cma allocator should try nodes in the node distance
> order. Possible but not sure how much we really do care for those who
> preallocate cma pools. Also __GFP_NOWAIT should skip CMA as that
> requires mutex - or even better make alloc_cma gfp aware. Likely few
> more things.
> 
> If we care then something for a patch or two on its own and also make
> the cma part a function on its own to remove the ugly ifdef.

Agreed.  There is plenty of room for improvement which can be done with
subsequent changes.

>> Fixes: cf11e85fc08cc6a4 ("mm: hugetlb: optionally allocate gigantic hugepages using cma")
>> Cc: Roman Gushchin <guro@fb.com>
>> Cc: Mike Kravetz <mike.kravetz@oracle.com>
>> Cc: Michal Hocko <mhocko@kernel.org>
>> Signed-off-by: Li Xinhai <lixinhai.lxh@gmail.com>
> 
> Acked-by: Michal Hocko <mhocko@suse.com>

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>

-- 
Mike Kravetz


      reply	other threads:[~2020-09-02 18:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02  2:50 Li Xinhai
2020-09-02  6:14 ` Michal Hocko
2020-09-02 18:07   ` Mike Kravetz [this message]

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=c2474631-3ca6-5411-fd9d-73ffa28fb7ec@oracle.com \
    --to=mike.kravetz@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=guro@fb.com \
    --cc=linux-mm@kvack.org \
    --cc=lixinhai.lxh@gmail.com \
    --cc=mhocko@suse.com \
    /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