linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hushijie <hushijie3@huawei.com>
To: Mike Kravetz <mike.kravetz@oracle.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: Mon, 18 May 2020 06:23:26 +0000	[thread overview]
Message-ID: <c27a402512b84ce598420b28f525eb75@huawei.com> (raw)

>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
>

Yes, It still works for our use case.

Thanks for your replies and suggestions, I will submit patch v6 later.
--
Shijie Hu

             reply	other threads:[~2020-05-18  6:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18  6:23 Hushijie [this message]
  -- strict thread matches above, loose matches on Subject: below --
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
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=c27a402512b84ce598420b28f525eb75@huawei.com \
    --to=hushijie3@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.huangjianhui@huawei.com \
    --cc=cg.chen@huawei.com \
    --cc=chenjie6@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --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).