linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: Oscar Salvador <osalvador@suse.de>
Cc: <linux-mm@kvack.org>, <akpm@linux-foundation.org>,
	Xu Yu <xuyu@linux.alibaba.com>
Subject: Re: [PATCH] mm/memory-failure.c: bail out early if huge zero page
Date: Tue, 12 Apr 2022 18:58:33 +0800	[thread overview]
Message-ID: <e8bd37da-9532-5bb5-4bb4-0bf4df781a50@huawei.com> (raw)
In-Reply-To: <YlVGxQfYgocSzrlW@localhost.localdomain>

On 2022/4/12 17:30, Oscar Salvador wrote:
> On Tue, Apr 12, 2022 at 05:25:52PM +0800, Miaohe Lin wrote:
>> On 2022/4/12 16:31, Oscar Salvador wrote:
>>> On Sun, Apr 10, 2022 at 11:22:34PM +0800, Xu Yu wrote:
>>>> Kernel panic when injecting memory_failure for the global huge_zero_page,
>>>> when CONFIG_DEBUG_VM is enabled, as follows.
>>> ... 
>>>> In fact, huge_zero_page is unhandlable currently in either soft offline
>>>> or memory failure injection.  With CONFIG_DEBUG_VM disabled,
>>>> huge_zero_page is bailed out when checking HWPoisonHandlable() in
>>>> get_any_page(), or checking page mapping in split_huge_page_to_list().
>>>>
>>>> This makes huge_zero_page bail out early in madvise_inject_error(), and
>>>> panic above won't happen again.
>>>
>>> I would not special case this in madvise_inject_error() but rather
>>> handle it in memory-failure code.
>>> We do already have HWPoisonHandlable(), which tells us whether the page
>>> is of a type we can really do something about, so why not add another
>>> check in HWPoisonHandlable() for huge_zero_page(), and have that checked
>>> in memory_failure().
>>
>> IIUC, this does not work. Because HWPoisonHandlable is only called in !MF_COUNT_INCREASED case.
>> But MF_COUNT_INCREASED is always set when called from madvise_inject_error, so HWPoisonHandlable
>> is not even called in this scene. Or am I miss something?
> 
> But nothing stops you from calling it in memory_failure(), right?
> 
>  if (MF_COUNT_INCREASED not set) {
>   ....
>   ...
>  } else if(!HWPoisonHandable(p)) {
>          action_result(pfn, MF_MSG_UNKNOWN, MF_IGNORED);
>          res = -EBUSY;
>          goto unlock_mutex;
>  }

Yes, I somewhat misread the proposed code. Thanks for clarifying. :)

> 
>> BTW: IIRC, LRU isn't set on huge_zero_page. So the origin HWPoisonHandlable can already filter out this page.
> 
> I would rather have it as a explicit check than buried in that kind of
> assumption.
> 
> But after all, Naoya's suggestion might just be better and more focused.
> 
> 



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

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-10 15:22 [PATCH] mm/memory-failure.c: bail out early if huge zero page Xu Yu
2022-04-11  2:18 ` Miaohe Lin
2022-04-12  9:09   ` Naoya Horiguchi
2022-04-12  9:45     ` Yu Xu
2022-04-12 10:00       ` Yu Xu
2022-04-12 11:11         ` HORIGUCHI NAOYA(堀口 直也)
2022-04-12 11:08     ` Miaohe Lin
2022-04-13  8:36       ` HORIGUCHI NAOYA(堀口 直也)
2022-04-13  9:03         ` Miaohe Lin
2022-04-12  8:31 ` Oscar Salvador
2022-04-12  9:25   ` Miaohe Lin
2022-04-12  9:30     ` Oscar Salvador
2022-04-12  9:47       ` Yu Xu
2022-04-12 10:58       ` Miaohe Lin [this message]
2022-04-12  8:59 ` Yu Xu

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=e8bd37da-9532-5bb5-4bb4-0bf4df781a50@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --cc=xuyu@linux.alibaba.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).