linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: "Song Bao Hua (Barry Song)" <song.bao.hua@hisilicon.com>,
	Roman Gushchin <guro@fb.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linuxarm <linuxarm@huawei.com>,
	Jonathan Cameron <jonathan.cameron@huawei.com>
Subject: Re: [PATCH v3] mm/hugetlb: avoid hardcoding while checking if cma is enable
Date: Thu, 9 Jul 2020 17:24:14 -0700	[thread overview]
Message-ID: <99dd3c24-a864-c0e2-4f02-33a7fbc97bc7@oracle.com> (raw)
In-Reply-To: <B926444035E5E2439431908E3842AFD256460F@DGGEMI525-MBS.china.huawei.com>

On 7/9/20 4:45 PM, Song Bao Hua (Barry Song) wrote:
> 
> 
>> -----Original Message-----
>> From: Mike Kravetz [mailto:mike.kravetz@oracle.com]
>> Sent: Friday, July 10, 2020 6:58 AM
>> To: Song Bao Hua (Barry Song) <song.bao.hua@hisilicon.com>; Roman
>> Gushchin <guro@fb.com>
>> Cc: Andrew Morton <akpm@linux-foundation.org>; linux-mm@kvack.org;
>> linux-kernel@vger.kernel.org; Linuxarm <linuxarm@huawei.com>; Jonathan
>> Cameron <jonathan.cameron@huawei.com>
>> Subject: Re: [PATCH v3] mm/hugetlb: avoid hardcoding while checking if cma
>> is enable
>>
>> Looks like this produced a warning in linux-next.  I suspect it is due to the
>> combination CONFIG_HUGETLB_PAGE && !CONFIG_CMA.
>>
>> Instead of adding the routine hugetlb_cma_enabled() to scan the hugetlb_cma
>> array, could we just use a boolean as follows?  It can simply be set in
>> hugetlb_cma_reserve when we reserve CMA.
> 
> Maybe just use hugetlb_cma_size? If hugetlb_cma_size is not 0, someone is trying to use
> cma, then bootmem for gigantic pages will be totally ignored according to discussion here:
> https://lkml.org/lkml/2020/7/8/1288
> 
> if somebody sets a wrong hugetlb_cma_size which causes that cma is not reserved. 
> It is the fault of users? We just need to document hugetlb_cma will overwrite bootmem
> reservations?
> 

Yes, I think using hugetlb_cma_size would be sufficient.  If someone
specifies hugetlb_cma=<N> and hugepagesz=<gigantic_page_size> hugepages=<X>
that is wrong.  I don't think we need to worry about 'falling back' to
preallocating X gigantic pages if N is a bad value.  Or, even if the arch
does not support cma allocation.

I am working on a patch to check this earlier in command processing.  That
will make this check unnecessary.  However, that patch is based on new
command line processing code only in 5.8.  So, I think we still need to do
this so that it can be backported to stable.
-- 
Mike Kravetz


      reply	other threads:[~2020-07-10  0:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07  4:02 [PATCH v3] mm/hugetlb: avoid hardcoding while checking if cma is enable Barry Song
2020-07-07  8:18 ` Mike Rapoport
2020-07-07 19:56 ` Andrew Morton
2020-07-08 17:45   ` Mike Kravetz
2020-07-08 18:46     ` Roman Gushchin
2020-07-08 22:11       ` Song Bao Hua (Barry Song)
2020-07-09 18:58         ` Mike Kravetz
2020-07-09 23:45           ` Song Bao Hua (Barry Song)
2020-07-10  0:24             ` 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=99dd3c24-a864-c0e2-4f02-33a7fbc97bc7@oracle.com \
    --to=mike.kravetz@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=guro@fb.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxarm@huawei.com \
    --cc=song.bao.hua@hisilicon.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;
as well as URLs for NNTP newsgroup(s).