From: Liu Shixin <liushixin2@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: Re: [PATCH] mm/huge_memory: prevent THP_ZERO_PAGE_ALLOC increased twice
Date: Thu, 8 Sep 2022 11:28:52 +0800 [thread overview]
Message-ID: <6c0aeb6c-0dcc-2abb-d6af-559ff881d289@huawei.com> (raw)
In-Reply-To: <20220907163532.413d52275e8a8d865e9321d2@linux-foundation.org>
On 2022/9/8 7:35, Andrew Morton wrote:
> On Tue, 6 Sep 2022 09:52:23 +0800 Liu Shixin <liushixin2@huawei.com> wrote:
>
>> On 2022/9/6 4:07, Andrew Morton wrote:
>>> On Mon, 5 Sep 2022 21:38:13 +0800 Liu Shixin <liushixin2@huawei.com> wrote:
>>>
>>>> If two or more threads call get_huge_zero_page concurrently, THP_ZERO_PAGE_ALLOC
>>>> may increased two or more times. But actually, this should only count
>>>> as once since the extra zero pages has been freed.
>>> Well, for better of for worse,
>>> Documentation/admin-guide/mm/transhuge.rst says
>>>
>>> thp_zero_page_alloc
>>> is incremented every time a huge zero page is
>>> successfully allocated. It includes allocations which where
>>> dropped due race with other allocation. Note, it doesn't count
>>> every map of the huge zero page, only its allocation.
>>>
>>> If you think this interprtation should be changed then please explain
>>> why, and let's be sure to update the documentation accordingly.
>>>
>>> .
>> Thanks for your explanation. I misunderstood the meaning of thp_zero_page_alloc before.
>> Although the rules are clearly explained in the documentation, I think that this variable
>> should only incremented when a huge zero page used for thp is successfully allocated and
>> the pages dropped due race should skip increment. It seems strange to count in all allocations.
>>
>> If there's something I still misunderstand, please point it out, thanks.
> It seems strange to me also. Perhaps there's a rationale buried in the
> git and mailing list history.
>
> .
I didn't find previous discussion about this point. I update document in v2.
Kirill, what do you think about this change?
https://lore.kernel.org/linux-mm/20220908035533.2186159-1-liushixin2@huawei.com/
prev parent reply other threads:[~2022-09-08 3:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-05 13:38 Liu Shixin
2022-09-05 20:07 ` Andrew Morton
2022-09-06 1:52 ` Liu Shixin
2022-09-07 23:35 ` Andrew Morton
2022-09-08 3:28 ` Liu Shixin [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=6c0aeb6c-0dcc-2abb-d6af-559ff881d289@huawei.com \
--to=liushixin2@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=wangkefeng.wang@huawei.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