From: Rik van Riel <riel@surriel.com>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: linux-mm@kvack.org, kernel-team@fb.com,
Oscar Salvador <osalvador@suse.de>,
Naoya Horiguchi <naoya.horiguchi@nec.com>,
Mel Gorman <mgorman@suse.de>,
Johannes Weiner <hannes@cmpxchg.org>,
Andrew Morton <akpm@linux-foundation.org>,
stable@vger.kernel.org,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm,hwpoison: unmap poisoned page before invalidation
Date: Sat, 26 Mar 2022 16:14:54 -0400 [thread overview]
Message-ID: <5b734809fef4d76944490d5ac3ea816f0756b90a.camel@surriel.com> (raw)
In-Reply-To: <e6aa40b9-1cd8-b13f-555b-5f8ad863f196@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 2483 bytes --]
On Sat, 2022-03-26 at 15:48 +0800, Miaohe Lin wrote:
> On 2022/3/26 4:14, Rik van Riel wrote:
> >
> > +++ b/mm/memory.c
> > @@ -3918,14 +3918,18 @@ static vm_fault_t __do_fault(struct
> > vm_fault *vmf)
> > return ret;
> >
> > if (unlikely(PageHWPoison(vmf->page))) {
> > + struct page *page = vmf->page;
> > vm_fault_t poisonret = VM_FAULT_HWPOISON;
> > if (ret & VM_FAULT_LOCKED) {
> > + if (page_mapped(page))
> > + unmap_mapping_pages(page_mapping(pa
> > ge),
> > + page->index, 1,
> > false);
>
> It seems this unmap_mapping_pages also helps the success rate of the
> below invalidate_inode_page.
>
That is indeed what it is supposed to do.
It isn't fool proof, since you can still end up
with dirty pages that don't get cleaned immediately,
but it seems to turn infinite loops of a program
being killed every time it's started into a more
manageable situation where the task succeeds again
pretty quickly.
> > /* Retry if a clean page was removed from
> > the cache. */
> > - if (invalidate_inode_page(vmf->page))
> > - poisonret = 0;
> > - unlock_page(vmf->page);
> > + if (invalidate_inode_page(page))
> > + poisonret = VM_FAULT_NOPAGE;
> > + unlock_page(page);
> > }
> > - put_page(vmf->page);
> > + put_page(page);
>
> Do we use page instead of vmf->page just for simplicity? Or there is
> some other concern?
>
Just a simplification, and not dereferencing the same thing
6 times.
> > vmf->page = NULL;
>
> We return either VM_FAULT_NOPAGE or VM_FAULT_HWPOISON with vmf->page
> = NULL. If any case,
> finish_fault won't be called later. So I think your fix is right.
Want to send in a Reviewed-by or Acked-by? :)
--
All Rights Reversed.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-03-26 20:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-25 20:14 Rik van Riel
2022-03-26 7:48 ` Miaohe Lin
2022-03-26 20:14 ` Rik van Riel [this message]
2022-03-28 2:14 ` Miaohe Lin
2022-03-28 2:24 ` Rik van Riel
2022-03-28 2:41 ` Miaohe Lin
2022-03-28 9:00 ` Oscar Salvador
2022-03-29 15:49 ` Rik van Riel
2022-03-29 19:13 ` Oscar Salvador
2022-03-28 11:01 ` HORIGUCHI NAOYA(堀口 直也)
2022-03-29 19:13 ` Oscar Salvador
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=5b734809fef4d76944490d5ac3ea816f0756b90a.camel@surriel.com \
--to=riel@surriel.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=naoya.horiguchi@nec.com \
--cc=osalvador@suse.de \
--cc=stable@vger.kernel.org \
/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