From: Yu Zhao <yuzhao@google.com>
To: Usama Arif <usamaarif642@gmail.com>
Cc: Bharata B Rao <bharata@amd.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
nikunj@amd.com, "Upadhyay, Neeraj" <Neeraj.Upadhyay@amd.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>,
willy@infradead.org, vbabka@suse.cz, kinseyho@google.com,
Mel Gorman <mgorman@suse.de>,
leitao@debian.org
Subject: Re: Hard and soft lockups with FIO and LTP runs on a large system
Date: Tue, 13 Aug 2024 11:43:52 -0600 [thread overview]
Message-ID: <CAOUHufYj1oHVy1OnqVMqsYbtMTqyCo-19ZH-UOiz46KDrp8m3w@mail.gmail.com> (raw)
In-Reply-To: <0702c85c-abca-4a33-b91b-dadf68670364@gmail.com>
On Tue, Aug 13, 2024 at 5:04 AM Usama Arif <usamaarif642@gmail.com> wrote:
>
>
>
> On 09/07/2024 06:58, Yu Zhao wrote:
> > On Mon, Jul 8, 2024 at 10:31 PM Bharata B Rao <bharata@amd.com> wrote:
> >>
> >> On 08-Jul-24 9:47 PM, Yu Zhao wrote:
> >>> On Mon, Jul 8, 2024 at 8:34 AM Bharata B Rao <bharata@amd.com> wrote:
> >>>>
> >>>> Hi Yu Zhao,
> >>>>
> >>>> Thanks for your patches. See below...
> >>>>
> >>>> On 07-Jul-24 4:12 AM, Yu Zhao wrote:
> >>>>> Hi Bharata,
> >>>>>
> >>>>> On Wed, Jul 3, 2024 at 9:11 AM Bharata B Rao <bharata@amd.com> wrote:
> >>>>>>
> >>>> <snip>
> >>>>>>
> >>>>>> Some experiments tried
> >>>>>> ======================
> >>>>>> 1) When MGLRU was enabled many soft lockups were observed, no hard
> >>>>>> lockups were seen for 48 hours run. Below is once such soft lockup.
> >>>>>
> >>>>> This is not really an MGLRU issue -- can you please try one of the
> >>>>> attached patches? It (truncate.patch) should help with or without
> >>>>> MGLRU.
> >>>>
> >>>> With truncate.patch and default LRU scheme, a few hard lockups are seen.
> >>>
> >>> Thanks.
> >>>
> >>> In your original report, you said:
> >>>
> >>> Most of the times the two contended locks are lruvec and
> >>> inode->i_lock spinlocks.
> >>> ...
> >>> Often times, the perf output at the time of the problem shows
> >>> heavy contention on lruvec spin lock. Similar contention is
> >>> also observed with inode i_lock (in clear_shadow_entry path)
> >>>
> >>> Based on this new report, does it mean the i_lock is not as contended,
> >>> for the same path (truncation) you tested? If so, I'll post
> >>> truncate.patch and add reported-by and tested-by you, unless you have
> >>> objections.
> >>
> >> truncate.patch has been tested on two systems with default LRU scheme
> >> and the lockup due to inode->i_lock hasn't been seen yet after 24 hours run.
> >
> > Thanks.
> >
> >>>
> >>> The two paths below were contended on the LRU lock, but they already
> >>> batch their operations. So I don't know what else we can do surgically
> >>> to improve them.
> >>
> >> What has been seen with this workload is that the lruvec spinlock is
> >> held for a long time from shrink_[active/inactive]_list path. In this
> >> path, there is a case in isolate_lru_folios() where scanning of LRU
> >> lists can become unbounded. To isolate a page from ZONE_DMA, sometimes
> >> scanning/skipping of more than 150 million folios were seen. There is
> >> already a comment in there which explains why nr_skipped shouldn't be
> >> counted, but is there any possibility of re-looking at this condition?
> >
> > For this specific case, probably this can help:
> >
> > @@ -1659,8 +1659,15 @@ static unsigned long
> > isolate_lru_folios(unsigned long nr_to_scan,
> > if (folio_zonenum(folio) > sc->reclaim_idx ||
> > skip_cma(folio, sc)) {
> > nr_skipped[folio_zonenum(folio)] += nr_pages;
> > - move_to = &folios_skipped;
> > - goto move;
> > + list_move(&folio->lru, &folios_skipped);
> > + if (spin_is_contended(&lruvec->lru_lock)) {
> > + if (!list_empty(dst))
> > + break;
> > + spin_unlock_irq(&lruvec->lru_lock);
> > + cond_resched();
> > + spin_lock_irq(&lruvec->lru_lock);
> > + }
> > + continue;
Nitpick:
if () {
...
if (!spin_is_contended(&lruvec->lru_lock))
continue;
if (!list_empty(dst))
break;
spin_unlock_irq(&lruvec->lru_lock);
cond_resched();
spin_lock_irq(&lruvec->lru_lock);
}
> Hi Yu,
>
> We are seeing lockups and high memory pressure in Meta production due to this lock contention as well. My colleague highlighted it in https://lore.kernel.org/all/ZrssOrcJIDy8hacI@gmail.com/ and was pointed to this fix.
>
> We removed skip_cma check as a temporary measure, but this is a proper fix. I might have missed it but didn't see this as a patch on the mailing list. Just wanted to check if you were planning to send it as a patch? Happy to send it on your behalf as well.
Please. Thank you.
next prev parent reply other threads:[~2024-08-13 17:44 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 15:11 Bharata B Rao
2024-07-06 22:42 ` Yu Zhao
2024-07-08 14:34 ` Bharata B Rao
2024-07-08 16:17 ` Yu Zhao
2024-07-09 4:30 ` Bharata B Rao
2024-07-09 5:58 ` Yu Zhao
2024-07-11 5:43 ` Bharata B Rao
2024-07-15 5:19 ` Bharata B Rao
2024-07-19 20:21 ` Yu Zhao
2024-07-20 7:57 ` Mateusz Guzik
2024-07-22 4:17 ` Bharata B Rao
2024-07-22 4:12 ` Bharata B Rao
2024-07-25 9:59 ` zhaoyang.huang
2024-07-26 3:26 ` Zhaoyang Huang
2024-07-29 4:49 ` Bharata B Rao
2024-08-13 11:04 ` Usama Arif
2024-08-13 17:43 ` Yu Zhao [this message]
2024-07-17 9:37 ` Vlastimil Babka
2024-07-17 10:50 ` Bharata B Rao
2024-07-17 11:15 ` Hillf Danton
2024-07-18 9:02 ` Bharata B Rao
2024-07-10 12:03 ` Bharata B Rao
2024-07-10 12:24 ` Mateusz Guzik
2024-07-10 13:04 ` Mateusz Guzik
2024-07-15 5:22 ` Bharata B Rao
2024-07-15 6:48 ` Mateusz Guzik
2024-07-10 18:04 ` Yu Zhao
2024-07-17 9:42 ` Vlastimil Babka
2024-07-17 10:31 ` Bharata B Rao
2024-07-17 16:44 ` Karim Manaouil
2024-07-17 11:29 ` Mateusz Guzik
2024-07-18 9:00 ` Bharata B Rao
2024-07-18 12:11 ` Mateusz Guzik
2024-07-19 6:16 ` Bharata B Rao
2024-07-19 7:06 ` Yu Zhao
2024-07-19 14:26 ` Mateusz Guzik
2024-07-17 16:34 ` Karim Manaouil
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=CAOUHufYj1oHVy1OnqVMqsYbtMTqyCo-19ZH-UOiz46KDrp8m3w@mail.gmail.com \
--to=yuzhao@google.com \
--cc=Neeraj.Upadhyay@amd.com \
--cc=akpm@linux-foundation.org \
--cc=bharata@amd.com \
--cc=david@redhat.com \
--cc=kinseyho@google.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=nikunj@amd.com \
--cc=usamaarif642@gmail.com \
--cc=vbabka@suse.cz \
--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