linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: "HORIGUCHI NAOYA(堀口 直也)" <naoya.horiguchi@nec.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"shy828301@gmail.com" <shy828301@gmail.com>,
	"mike.kravetz@oracle.com" <mike.kravetz@oracle.com>,
	"david@redhat.com" <david@redhat.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] mm/memory-failure.c: dissolve truncated hugetlb page
Date: Tue, 12 Apr 2022 14:10:47 +0800	[thread overview]
Message-ID: <20403524-98f8-ce51-65c6-0430a38b14b8@huawei.com> (raw)
In-Reply-To: <20220412055922.GA3227993@hori.linux.bs1.fc.nec.co.jp>

On 2022/4/12 13:59, HORIGUCHI NAOYA(堀口 直也) wrote:
> On Tue, Apr 12, 2022 at 10:47:53AM +0800, Miaohe Lin wrote:
>> On 2022/4/11 21:13, HORIGUCHI NAOYA(堀口 直也) wrote:
>>> Hi Miaohe,
>>>
>>> On Thu, Apr 07, 2022 at 09:03:52PM +0800, Miaohe Lin wrote:
>>>> If me_huge_page meets a truncated huge page, hpage won't be dissolved
>>>
>>> I might not understand correctly what "truncated huge page" means.  If it
>>> means the page passed to me_huge_page() and truncate_error_page() is called
>>> on it, the else branch you're trying to update is not chosen, so maybe it
>>> sounds irrelevant to me?  Could you elaborate it or share the procedure to
>>> reproduce the case you care about?
>>
>> Sorry for making confusing. What 'truncated hugetlb page' means is that a hugepage is
>> truncated but still on the way to free. So HPageMigratable is still set and we might
>> come across it here. Does this make sense for you?
> 
> Yes, it does. Thank you.
> 
>>
>>>
>>>> even if we hold the last refcnt. It's because the truncated huge page
>>>> has NULL page_mapping while it's not anonymous page too. Thus we lose
>>>> the last chance to dissolve it into buddy to save healthy subpages.
>>>> Remove PageAnon check to handle these huge pages too.
>>>>
>>>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>>>> ---
>>>>  mm/memory-failure.c | 3 +--
>>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>>
>>>> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
>>>> index bd563f47630c..3f054dbb169d 100644
>>>> --- a/mm/memory-failure.c
>>>> +++ b/mm/memory-failure.c
>>>> @@ -1046,8 +1046,7 @@ static int me_huge_page(struct page_state *ps, struct page *p)
>>>>  		 * hugepage, so we can free and dissolve it into buddy to
>>>>  		 * save healthy subpages.
>>>>  		 */
>>>> -		if (PageAnon(hpage))
>>>> -			put_page(hpage);
>>>
>>> I think that the reason of this "if (PageAnon(hpage))" is to not remove
>>> hugepages for hugetlbfs files.  Unlike anonymous hugepage, it can be
>>> accessed from file after error handling, so we can't simply dissolve it
>>> because otherwise another process reading the hugepage sees zeroed one
>>> without knowing the memory error.
>>
>> In this branch, we have precondition that page_mapping is NULL. So it can't be hugepages
>> for hugetlbfs files. It should be anonymous hugepages in most cases. If it's not anonymous
>> hugepages too, i.e. (!page_mapping(hpage) && !PageAnon(hpage)), it could be free hugepages
>> or 'truncated hugetlb page'. But we have already handled the free hugepages case, it should
>> be 'truncated hugetlb page' here. Since it's on the way to free, we should put the refcnt
>> to increase the chance that we can free and dissolve it into buddy to save healthy subpages.
>> Or am I miss something?
> 
> No, it sounds correct.  So I agree with removing the "if".  Could you also
> update the inline comment just above it in the next version?  We no longer
> need to limitedly mention "anonymous hugepage".

Sure. Will do it in next version. Many thanks!

> 
> Thanks,
> Naoya Horiguchi
>


      reply	other threads:[~2022-04-12  6:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 13:03 [PATCH 0/3] A few fixup and cleanup patches for memory failure Miaohe Lin
2022-04-07 13:03 ` [PATCH 1/3] mm/memory-failure.c: avoid false-postive PageSwapCache test Miaohe Lin
2022-04-08  8:52   ` David Hildenbrand
2022-04-08 17:32     ` Yang Shi
2022-04-09  2:36       ` Miaohe Lin
2022-04-11  6:35   ` HORIGUCHI NAOYA(堀口 直也)
2022-04-11 13:19     ` Miaohe Lin
2022-04-12  6:37       ` HORIGUCHI NAOYA(堀口 直也)
2022-04-12  8:57         ` Miaohe Lin
2022-04-07 13:03 ` [PATCH 2/3] mm/memory-failure.c: minor cleanup for HWPoisonHandlable Miaohe Lin
2022-04-08  8:52   ` David Hildenbrand
2022-04-08 17:33   ` Yang Shi
2022-04-11 13:14   ` HORIGUCHI NAOYA(堀口 直也)
2022-04-07 13:03 ` [PATCH 3/3] mm/memory-failure.c: dissolve truncated hugetlb page Miaohe Lin
2022-04-11 13:13   ` HORIGUCHI NAOYA(堀口 直也)
2022-04-12  2:47     ` Miaohe Lin
2022-04-12  5:59       ` HORIGUCHI NAOYA(堀口 直也)
2022-04-12  6:10         ` Miaohe Lin [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=20403524-98f8-ce51-65c6-0430a38b14b8@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=naoya.horiguchi@nec.com \
    --cc=shy828301@gmail.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