linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nitesh Narayan Lal <nitesh@redhat.com>
To: Mike Kravetz <mike.kravetz@oracle.com>,
	"Longpeng (Mike)" <longpeng2@huawei.com>
Cc: arei.gonglei@huawei.com, huangzhichao@huawei.com,
	Matthew Wilcox <willy@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>, Qian Cai <cai@lca.pw>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm/hugetlb: avoid weird message in hugetlb_init
Date: Wed, 15 Apr 2020 07:46:56 -0400	[thread overview]
Message-ID: <5c6595f7-7a8a-935f-7267-c2a16ccb1997@redhat.com> (raw)
In-Reply-To: <0b8d283f-dd31-b980-5d53-4bbca4014da7@oracle.com>


[-- Attachment #1.1: Type: text/plain, Size: 3138 bytes --]


On 4/15/20 12:03 AM, Mike Kravetz wrote:
> On 4/13/20 2:21 PM, Nitesh Narayan Lal wrote:
>> On 4/13/20 2:33 PM, Mike Kravetz wrote:
>>> On 4/10/20 8:47 AM, Nitesh Narayan Lal wrote:
>>>> Hi Mike,
>>>>
>>>> On platforms that support multiple huge page sizes when 'hugepagesz' is not
>>>> specified before 'hugepages=', hugepages are not allocated. (For example
>>>> if we are requesting 1GB hugepages)
>>> Hi Nitesh,
>>>
>>> This should only be an issue with gigantic huge pages.  This is because
>>> hugepages=X not following a hugepagesz=Y specifies the number of huge pages
>>> of default size to allocate.  It does not currently work for gigantic pages.
>> I see, since we changed the default hugepages to gigantic pages and we missed
>> 'hugepagesz=' no page were allocated of any type.
>>
>>> In the other thread, I provided this explanation as to why:
>>> It comes about because we do not definitively set the default huge page size
>>> until after command line processing (in hugetlb_init).  And, we must
>>> preallocate gigantic huge pages during command line processing because that
>>> is when the bootmem allocater is available.
>>>
>>> I will be looking into modifying this behavior to allocate the pages as
>>> expected, even for gigantic pages.
>> Nice, looking forward to it.
>>
>>>> In terms of reporting meminfo and /sys/kernel/../nr_hugepages reports the
>>>> expected results but if we use sysctl vm.nr_hugepages then it reports a non-zero
>>>> value as it reads the max_huge_pages from the default hstate instead of
>>>> nr_huge_pages.
>>>> AFAIK nr_huge_pages is the one that indicates the number of huge pages that are
>>>> successfully allocated.
>>>>
>>>> Does vm.nr_hugepages is expected to report the maximum number of hugepages? If
>>>> so, will it not make sense to rename the procname?
>>>>
>>>> However, if we expect nr_hugepages to report the number of successfully
>>>> allocated hugepages then we should use nr_huge_pages in
>>>> hugetlb_sysctl_handler_common().
>>> This looks like a bug.  Neither sysctl or the /proc file should be reporting
>>> a non-zero value if huge pages do not exist.
>> Yeap, as I mentioned it reports max_huge_pages instead of the nr_huge_pages.
> Does this only happen when you specify gigantic pages as the default huge
> page size and they are not allocated at boot time?

Yes.

>   Or, are there other
> situations where this happens?  If so, can you provide a sample of the
> boot parameters used, or how to recreate.

To reproduce this behavior boot the kernel with 'default_hugepagesz=1G
hugepages=8' parameter in the kernel cmdline, hugepagesz needs to be
skipped to ensure that no gigantic hugepages are allocated. After the
kernel is up check the output of 'sysctl vm.nr_hugepages'.
This should be good enough to reproduce this issue.

>
> I am fixing up the issue with gigantic pages, and suspect this will take
> are of all the issues you are seeing.  This will be part of the command line
> cleanup series.  Just want to make sure I am not missing something.
Makes sense. Thank you.

-- 
Nitesh


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2020-04-15 11:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05  3:30 [PATCH] mm/hugetlb: avoid weird message in hugetlb_init Longpeng(Mike)
2020-03-06  0:09 ` Mike Kravetz
2020-03-06  6:36   ` Longpeng (Mike)
2020-03-06 20:12     ` Mike Kravetz
2020-03-09  8:16       ` Longpeng (Mike)
2020-04-10 15:47       ` Nitesh Narayan Lal
2020-04-13 18:33         ` Mike Kravetz
2020-04-13 21:21           ` Nitesh Narayan Lal
2020-04-15  4:03             ` Mike Kravetz
2020-04-15 11:46               ` Nitesh Narayan Lal [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=5c6595f7-7a8a-935f-7267-c2a16ccb1997@redhat.com \
    --to=nitesh@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=arei.gonglei@huawei.com \
    --cc=cai@lca.pw \
    --cc=huangzhichao@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=longpeng2@huawei.com \
    --cc=mike.kravetz@oracle.com \
    --cc=willy@infradead.org \
    /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).