From: Mike Kravetz <mike.kravetz@oracle.com>
To: Hushijie <hushijie3@huawei.com>
Cc: "will@kernel.org" <will@kernel.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Nixiaoming <nixiaoming@huawei.com>,
"wangxu (AE)" <wangxu72@huawei.com>,
"Wangkefeng (OS Kernel Lab)" <wangkefeng.wang@huawei.com>,
yangerkun <yangerkun@huawei.com>,
"Wangle (RTOS FAE)" <wangle6@huawei.com>,
"Chengang (L)" <cg.chen@huawei.com>,
"Chenjie (K)" <chenjie6@huawei.com>,
"Huangjianhui (Alex)" <alex.huangjianhui@huawei.com>
Subject: Re: [PATCH v5] hugetlbfs: Get unmapped area below TASK_UNMAPPED_BASE for hugetlbfs
Date: Sun, 17 May 2020 21:16:18 -0700 [thread overview]
Message-ID: <273e15fc-8b54-84d0-992c-76e4598d1590@oracle.com> (raw)
In-Reply-To: <87d618c778584d2386c0f0c81be6319b@huawei.com>
On 5/16/20 12:47 AM, Hushijie wrote:
>> On 5/14/20 7:31 AM, Shijie Hu wrote:
>>> + if (mm->get_unmapped_area == arch_get_unmapped_area)
>>> + return hugetlb_get_unmapped_area_bottomup(file, addr, len,
>>> + pgoff, flags);
>>> + return hugetlb_get_unmapped_area_topdown(file, addr, len,
>>> + pgoff, flags);
>>
>> I like this code using the value of mm->get_unmapped_area to determine
>> which routine to call. It is used by a few architectures. However, I
>> noticed that on at least one architecture (powerpc) mm->get_unmapped_area
>> may be assigned to routines other than arch_get_unmapped_area or
>> arch_get_unmapped_area_topdown. In such a case, we would call the 'new'
>> topdown routine. I would prefer that we call the bottomup routine in this
>> default case.
>>
>> In reality, this does not impact powerpc as that architecture has it's
>> own hugetlb_get_unmapped_area routine.
>>
>
> Yes, I also noticed this before, powerpc uses radix__arch_get_unmapped_area*()
> when CONFIG_PPC_RADIX_MMU opened as 'y' and radix_enabled() returns
> true. However, powerpc implemented its own hugetlb_get_unmapped_area(). This
> patch actually has no effect on powerpc.
>
>> Because of this, I suggest we add a comment above this code and switch
>> the if/else order. For example,
>>
>> + /*
>> + * Use mm->get_unmapped_area value as a hint to use topdown routine.
>> + * If architectures have special needs, they should define their own
>> + * version of hugetlb_get_unmapped_area.
>> + */
>> + if (mm->get_unmapped_area == arch_get_unmapped_area_topdown)
>> + return hugetlb_get_unmapped_area_topdown(file, addr, len,
>> + pgoff, flags);
>> + return hugetlb_get_unmapped_area_bottomup(file, addr, len,
>> + pgoff, flags);
>>
>> Thoughts?
>> --
>> Mike Kravetz
>>
> I agree with you. It's clever to switch the if/else order. If there is such
> a case, mm->get_unmapped_area() is neihter arch_get_unmapped_area() nor
> arch_get_unmapped_area_topdown(), it is indeed more appropriate to make the
> bottomup routine as the default behavior.
>
> May I put this code and comment you show above into patch v6 and add
> "Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>" to it?
Feel free to add this code and my Signed-off-by.
I assume this still works for your use case. Correct?
--
Mike Kravetz
next prev parent reply other threads:[~2020-05-18 4:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-16 7:47 [PATCH v5] hugetlbfs: Get unmapped area below TASK_UNMAPPED_BASE for hugetlbfs Hushijie
2020-05-18 4:16 ` Mike Kravetz [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-05-18 6:23 Hushijie
2020-05-14 14:31 Shijie Hu
2020-05-15 18:44 ` Mike Kravetz
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=273e15fc-8b54-84d0-992c-76e4598d1590@oracle.com \
--to=mike.kravetz@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=alex.huangjianhui@huawei.com \
--cc=cg.chen@huawei.com \
--cc=chenjie6@huawei.com \
--cc=hushijie3@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nixiaoming@huawei.com \
--cc=wangkefeng.wang@huawei.com \
--cc=wangle6@huawei.com \
--cc=wangxu72@huawei.com \
--cc=will@kernel.org \
--cc=yangerkun@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;
as well as URLs for NNTP newsgroup(s).