linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yu Zhao <yuzhao@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Bharata B Rao <bharata@amd.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	Mel Gorman <mgorman@techsingularity.net>,
	 Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH mm-unstable v1] mm/truncate: batch-clear shadow entries
Date: Tue, 9 Jul 2024 16:27:54 -0600	[thread overview]
Message-ID: <CAOUHufZ42qn4vv+2w2MhFhqHib66s054YaXben28nddbZWRp5Q@mail.gmail.com> (raw)
In-Reply-To: <20240708151619.dc738d16d3b2d56d6c4fe285@linux-foundation.org>

On Mon, Jul 8, 2024 at 4:16 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Mon,  8 Jul 2024 15:27:53 -0600 Yu Zhao <yuzhao@google.com> wrote:
>
> > Make clear_shadow_entry() clear shadow entries in `struct folio_batch`
> > so that it can reduce contention on i_lock and i_pages locks, e.g.,
> >
> >   watchdog: BUG: soft lockup - CPU#29 stuck for 11s! [fio:2701649]
> >     clear_shadow_entry+0x3d/0x100
> >     mapping_try_invalidate+0x117/0x1d0
> >     invalidate_mapping_pages+0x10/0x20
> >     invalidate_bdev+0x3c/0x50
> >     blkdev_common_ioctl+0x5f7/0xa90
> >     blkdev_ioctl+0x109/0x270
>
> This will clearly reduce lock traffic a lot, but does it truly fix the
> issue?  Is it the case that sufficiently extreme loads will still run
> into problems?

I think Bharata was running extreme loads. So I'd say it's good enough
for now, considering truncation doesn't happen that often.

> > --- a/mm/truncate.c
> > +++ b/mm/truncate.c
> > @@ -39,12 +39,24 @@ static inline void __clear_shadow_entry(struct address_space *mapping,
> >       xas_store(&xas, NULL);
> >  }
> >
> > -static void clear_shadow_entry(struct address_space *mapping, pgoff_t index,
> > -                            void *entry)
> > +static void clear_shadow_entry(struct address_space *mapping,
> > +                            struct folio_batch *fbatch, pgoff_t *indices)
> >  {
> > +     int i;
> > +
> > +     if (shmem_mapping(mapping) || dax_mapping(mapping))
> > +             return;
>
> We lost the comment which was in invalidate_exceptional_entry() and
> elsewhere.  It wasn't a terribly good one but I do think a few words
> which explain why we're testing for these things would be helpful.

I'll put the original comment back. It seems to me it was stating the
obvious, and I don't really know how to improve it since it's obvious
;)

> I expect we should backport this.  But identifying a Fixes: target
> looks to be challenging.

I wouldn't worry about backporting, nobody else has run into this
scalability issue (not even a day-to-day performance problem).


  reply	other threads:[~2024-07-09 22:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-08 21:27 Yu Zhao
2024-07-08 22:16 ` Andrew Morton
2024-07-09 22:27   ` Yu Zhao [this message]
2024-07-08 22:36 ` Matthew Wilcox
2024-07-09 22:30   ` Yu Zhao

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=CAOUHufZ42qn4vv+2w2MhFhqHib66s054YaXben28nddbZWRp5Q@mail.gmail.com \
    --to=yuzhao@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=bharata@amd.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --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