From: Yosry Ahmed <yosryahmed@google.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Nhat Pham <nphamcs@gmail.com>,
Linux regressions mailing list <regressions@lists.linux.dev>,
Piotr Oniszczuk <piotr.oniszczuk@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Linux-MM <linux-mm@kvack.org>
Subject: Re: [regression] oops on heavy compilations ("kernel BUG at mm/zswap.c:1005!" and "Oops: invalid opcode: 0000")
Date: Fri, 23 Aug 2024 09:07:44 -0700 [thread overview]
Message-ID: <CAJD7tkbO938ETJn0FOG_vVU4V2_dBanio1QG56cp6ctFHpSeNw@mail.gmail.com> (raw)
In-Reply-To: <Zsig_AZDT5zOO1Wg@casper.infradead.org>
On Fri, Aug 23, 2024 at 7:47 AM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Fri, Aug 23, 2024 at 10:35:19AM -0400, Nhat Pham wrote:
> > On Fri, Aug 23, 2024 at 9:13 AM Matthew Wilcox <willy@infradead.org> wrote:
> > >
> > >
> > > That said, zswap could handle this better. There's no need to panic the
> > > entire machine over being unable to read a page from swap. Killing just
> > > the process that needed this page is sufficient.
> >
> > Agree 100%. It is silly to kill the entire host for a swap read error,
> > and extra silly to kill the process because we fail to writeback - for
> > all we know that page might never be needed by the process again!!!
> >
> > >
> > > Suggested patch at end after the oops.
> > >
> > > @@ -1601,6 +1613,7 @@ bool zswap_load(struct folio *folio)
> > > bool swapcache = folio_test_swapcache(folio);
> > > struct xarray *tree = swap_zswap_tree(swp);
> > > struct zswap_entry *entry;
> > > + int err;
> > >
> > > VM_WARN_ON_ONCE(!folio_test_locked(folio));
> > >
> > > @@ -1638,10 +1651,13 @@ bool zswap_load(struct folio *folio)
> > > if (!entry)
> > > return false;
> > >
> > > - if (entry->length)
> > > - zswap_decompress(entry, folio);
> > > - else
> > > + if (entry->length) {
> > > + err = zswap_decompress(entry, folio);
> > > + if (err)
> > > + return false;
> >
> > Here, if zswap decompression fails and zswap load returns false, the
> > page_io logic will proceed as if zswap does not have the page and
> > reads garbage from the backing device instead. This could potentially
> > lead to silent data/memory corruption right? Or am I missing something
> > :) Maybe we could be extra careful here and treat it as if there is a
> > bio read error in the case zswap owns the page, but cannot decompress
> > it?
>
> Ah; you know more about how zswap works than I do. So it's not a
> write-through cache? I guess we need to go a bit further then and
> return an errno from zswap_load -- EIO/ENOENT/0 and handle that
> appropriately.
It should work if we just return true without calling
folio_mark_uptodate(), this is what we do if we get a large folio in
zswap_load(). Returning true means that the page was found in zswap,
so we won't fallback to reading from the backing device. Not marking
the folio uptodate will cause an IO error IIUC.
>
> > The rest seems solid to me :)
next prev parent reply other threads:[~2024-08-23 16:08 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <BD22A15A-9216-4FA0-82DF-C7BBF8EE642E@gmail.com>
2024-08-23 11:51 ` Linux regression tracking (Thorsten Leemhuis)
2024-08-23 12:12 ` Piotr Oniszczuk
2024-08-23 13:13 ` Matthew Wilcox
2024-08-23 14:35 ` Nhat Pham
2024-08-23 14:47 ` Matthew Wilcox
2024-08-23 16:07 ` Yosry Ahmed [this message]
2024-08-23 15:06 ` Piotr Oniszczuk
2024-08-23 16:16 ` Nhat Pham
2024-08-23 17:24 ` Piotr Oniszczuk
2024-08-23 18:06 ` Nhat Pham
2024-08-24 10:50 ` Piotr Oniszczuk
2024-08-25 5:55 ` Piotr Oniszczuk
2024-08-25 15:05 ` Pedro Falcato
2024-08-25 16:24 ` Piotr Oniszczuk
2024-08-27 18:48 ` Yosry Ahmed
2024-08-29 15:50 ` Piotr Oniszczuk
2024-08-29 21:54 ` Yosry Ahmed
2024-08-29 22:29 ` Matthew Wilcox
2024-08-29 22:53 ` Yosry Ahmed
2024-08-31 9:41 ` Piotr Oniszczuk
2024-08-31 17:23 ` Yosry Ahmed
2024-09-02 8:57 ` Piotr Oniszczuk
2024-09-03 17:49 ` Yosry Ahmed
2024-09-03 22:43 ` Nhat Pham
2024-09-04 23:36 ` Yosry Ahmed
2024-09-13 9:03 ` Tomáš Trnka
2024-09-13 17:39 ` Yosry Ahmed
[not found] ` <27594ee6-41dd-4951-b4cc-31577c9466db@amd.com>
2024-09-03 17:52 ` Yosry Ahmed
2024-08-23 18:42 ` Takero Funaki
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=CAJD7tkbO938ETJn0FOG_vVU4V2_dBanio1QG56cp6ctFHpSeNw@mail.gmail.com \
--to=yosryahmed@google.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=piotr.oniszczuk@gmail.com \
--cc=regressions@lists.linux.dev \
--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