linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "HORIGUCHI NAOYA(堀口 直也)" <naoya.horiguchi@nec.com>
To: Jue Wang <juew@google.com>, Yang Shi <shy828301@gmail.com>
Cc: Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Linux FS-devel Mailing List <linux-fsdevel@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux MM <linux-mm@kvack.org>, Oscar Salvador <osalvador@suse.de>,
	Peter Xu <peterx@redhat.com>,
	Matthew Wilcox <willy@infradead.org>
Subject: RE: [v5 PATCH 6/6] mm: hwpoison: handle non-anonymous THP correctly
Date: Tue, 2 Nov 2021 03:10:26 +0000	[thread overview]
Message-ID: <TYWPR01MB85915B811AC5DEBDB915A380E78B9@TYWPR01MB8591.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <CAPcxDJ5G0UFj7-yLQCJ6xXsoXFKACfxFjA5jS6hztd0cTY1Big@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]


> On Mon, Nov 1, 2021 at 1:11 PM Yang Shi <shy828301@gmail.com <mailto:shy828301@gmail.com> > wrote:
>       On Mon, Nov 1, 2021 at 12:38 PM Jue Wang <juew@google.com <mailto:juew@google.com> > wrote:
>       >
>       > A related bug but whose fix may belong to a separate series:
>       >
>       > split_huge_page fails when invoked concurrently on the same THP page.
>       >
>       > It's possible that multiple memory errors on the same THP get consumed
>       > by multiple threads and come down to split_huge_page path easily.
>
>       Yeah, I think it should be a known problem since the very beginning.
>       The THP split requires to pin the page and does check if the refcount
>       is expected or not and freezes the refcount if it is expected. So if
>       two concurrent paths try to split the same THP, one will fail due to
>       the pin from the other path, but the other one will succeed.
>
> The failed thread will result in a -EBUSY from memory_failure and
> SIGBUS sent to the process without context (address, BUS_MCEERR_AR).
>
> This is undesirable for applications who intend to recover from memory
> errors.
>
> One possible fix is to recognize such cases and signal properly from
> memory_failure.

Thanks for sharing about the issue.
kill_accessing_process() might be helpful to send SIGBUS with address info
to the process who lost the race.

Thanks,
Naoya Horiguchi

>
>       I don't think of a better way to remediate it other than retrying from
>       the very start off the top of my head. We can't simply check if it is
>       still a THP or not since THP split will just move the refcount pin to
>       the poisoned subpage so the retry path will lose the refcount for its
>       poisoned subpage.
>
>       Did you run into this problem on any real production environment? Or
>       it is just a artificial test case? I'm wondering if the extra
>       complexity is worth or not.
>
> This can be easily reproduced in artificial test cases.
>
> I'd not surprised if production environment hits this bug.

[-- Attachment #2: Type: text/html, Size: 11128 bytes --]

  reply	other threads:[~2021-11-02  3:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 19:38 Jue Wang
2021-11-01 20:11 ` Yang Shi
2021-11-01 21:57   ` Jue Wang
2021-11-02  3:10     ` HORIGUCHI NAOYA(堀口 直也) [this message]
2021-11-02  3:49   ` Matthew Wilcox
2021-11-02 16:41     ` Yang Shi
  -- strict thread matches above, loose matches on Subject: below --
2021-10-20 21:07 [v5 PATCH 0/6] Solve silent data loss caused by poisoned page cache (shmem/tmpfs) Yang Shi
2021-10-20 21:07 ` [v5 PATCH 6/6] mm: hwpoison: handle non-anonymous THP correctly Yang Shi

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=TYWPR01MB85915B811AC5DEBDB915A380E78B9@TYWPR01MB8591.jpnprd01.prod.outlook.com \
    --to=naoya.horiguchi@nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=juew@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --cc=peterx@redhat.com \
    --cc=shy828301@gmail.com \
    --cc=willy@infradead.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