From: Yafang Shao <laoar.shao@gmail.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Dave Chinner <david@fromorbit.com>,
Kent Overstreet <kent.overstreet@linux.dev>,
Michal Hocko <mhocko@suse.com>,
Matthew Wilcox <willy@infradead.org>,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Dave Chinner <dchinner@redhat.com>
Subject: Re: [PATCH] bcachefs: Switch to memalloc_flags_do() for vmalloc allocations
Date: Mon, 2 Sep 2024 11:00:22 +0800 [thread overview]
Message-ID: <CALOAHbCPiDbQuSzZE-9VuHwkjX-UfXsHPMfdowdG31KhTPMXPQ@mail.gmail.com> (raw)
In-Reply-To: <f62e400e-49ab-4d0a-b2e2-c3bbb66c2ab1@suse.cz>
On Fri, Aug 30, 2024 at 11:25 PM Vlastimil Babka <vbabka@suse.cz> wrote:
>
> On 8/30/24 11:14, Yafang Shao wrote:
> > On Thu, Aug 29, 2024 at 10:29 PM Dave Chinner <david@fromorbit.com> wrote:
> >
> > Hello Dave,
> >
> > I've noticed that XFS has increasingly replaced kmem_alloc() with
> > __GFP_NOFAIL. For example, in kernel 4.19.y, there are 0 instances of
> > __GFP_NOFAIL under fs/xfs, but in kernel 6.1.y, there are 41
> > occurrences. In kmem_alloc(), there's an explicit
> > memalloc_retry_wait() to throttle the allocator under heavy memory
> > pressure, which aligns with your filesystem design. However, using
> > __GFP_NOFAIL removes this throttling mechanism, potentially causing
> > issues when the system is under heavy memory load. I'm concerned that
> > this shift might not be a beneficial trend.
> >
> > We have been using XFS for our big data servers for years, and it has
> > consistently performed well with older kernels like 4.19.y. However,
> > after upgrading all our servers from 4.19.y to 6.1.y over the past two
> > years, we have frequently encountered livelock issues caused by memory
> > exhaustion. To mitigate this, we've had to limit the RSS of
> > applications, which isn't an ideal solution and represents a worrying
> > trend.
>
> By "livelock issues caused by memory exhaustion" you mean the long-standing
> infamous issue that the system might become thrashing for the remaining
> small amount of page cache, and anonymous memory being swapped out/in,
> instead of issuing OOM, because there's always just enough progress of the
> reclaim to keep going, but the system isn't basically doing anything else?
>
Exactly
> I think that's related to near-exhausted memory by userspace,
If user space is the root cause, the appropriate response should be to
terminate the offending user tasks. However, this doesn't happen at
all.
> so I'm not
> sure why XFS would be to blame here.
Honestly, I'm not sure what to blame, as I don't have a clear
understanding of what's happening during memory allocation. One server
among tens of thousands in production randomly experiences a livelock
within days, making it extremely difficult to pinpoint the root cause.
>
> That said, if memalloc_retry_wait() is indeed a useful mechanism, maybe we
> could perform it inside the page allocator itself for __GFP_NOFAIL?
Perhaps an additional wait or exit mechanism should be implemented
specifically for __GFP_NOFAIL.
--
Regards
Yafang
next prev parent reply other threads:[~2024-09-02 3:00 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-28 14:06 [PATCH] bcachefs: Switch to memalloc_flags_do() for vmalloc allocations Kent Overstreet
2024-08-28 18:48 ` Matthew Wilcox
2024-08-28 19:11 ` Kent Overstreet
2024-08-28 19:26 ` Michal Hocko
2024-08-28 22:58 ` Kent Overstreet
2024-08-29 7:19 ` Michal Hocko
2024-08-29 11:41 ` Kent Overstreet
2024-08-29 11:08 ` Michal Hocko
2024-08-29 11:55 ` Kent Overstreet
2024-08-29 12:34 ` Michal Hocko
2024-08-29 12:42 ` Kent Overstreet
2024-08-29 14:27 ` Dave Chinner
2024-08-30 3:39 ` Theodore Ts'o
2024-08-31 15:46 ` Kent Overstreet
2024-08-30 9:14 ` Yafang Shao
2024-08-30 15:25 ` Vlastimil Babka
2024-09-02 3:00 ` Yafang Shao [this message]
2024-09-01 3:35 ` Dave Chinner
2024-09-02 3:02 ` Yafang Shao
2024-09-02 8:11 ` Michal Hocko
2024-09-02 9:01 ` Yafang Shao
2024-09-02 9:09 ` Michal Hocko
2024-09-03 6:34 ` Yafang Shao
2024-09-03 7:18 ` Michal Hocko
2024-09-03 12:44 ` Theodore Ts'o
2024-09-03 13:15 ` Yafang Shao
2024-09-03 14:03 ` Michal Hocko
2024-09-03 13:30 ` Michal Hocko
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=CALOAHbCPiDbQuSzZE-9VuHwkjX-UfXsHPMfdowdG31KhTPMXPQ@mail.gmail.com \
--to=laoar.shao@gmail.com \
--cc=david@fromorbit.com \
--cc=dchinner@redhat.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.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;
as well as URLs for NNTP newsgroup(s).