From: Mel Gorman <mgorman@suse.com>
To: Chuck Lever III <chuck.lever@oracle.com>
Cc: Neil Brown <neilb@suse.de>, Matthew Wilcox <willy@infradead.org>,
Bruce Fields <bfields@fieldses.org>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH] SUNRPC: use congestion_wait() in svc_alloc_args()
Date: Tue, 7 Sep 2021 16:41:25 +0100 [thread overview]
Message-ID: <20210907153116.GJ3828@suse.com> (raw)
In-Reply-To: <8ED6E493-21A6-46BC-810A-D9DA42996979@oracle.com>
On Tue, Sep 07, 2021 at 02:53:48PM +0000, Chuck Lever III wrote:
> > So maybe we really don't want reclaim_progress_wait(), and all current
> > callers of congestion_wait() which are just waiting for allocation to
> > succeed should be either change to use __GFP_NOFAIL, or to handle
> > failure.
>
> I had completely forgotten about GFP_NOFAIL. That seems like the
> preferred answer, as it avoids an arbitrary time-based wait for
> a memory resource. (And maybe svc_rqst_alloc() should also get
> the NOFAIL treatment?).
>
Don't use NOFAIL. It's intended for allocation requests that if they fail,
there is no sane way for the kernel to recover. Amoung other things,
it can access emergency memory reserves and if not returned quickly may
cause premature OOM or even a livelock.
> The question in my mind is how the new alloc_pages_bulk() will
> behave when passed NOFAIL. I would expect that NOFAIL would simply
> guarantee that at least one page is allocated on every call.
>
alloc_pages_bulk ignores GFP_NOFAIL. If called repeatedly, it might pass
the GFP_NOFAIL flag to allocate at least one page but you'll be depleting
reserves to do it from a call site that has other options for recovery.
The docs say it better
* %__GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller
* cannot handle allocation failures. The allocation could block
* indefinitely but will never return with failure. Testing for
* failure is pointless.
* New users should be evaluated carefully (and the flag should be
* used only when there is no reasonable failure policy) but it is
* definitely preferable to use the flag rather than opencode endless
* loop around allocator.
* Using this flag for costly allocations is _highly_ discouraged
--
Mel Gorman
SUSE Labs
next prev parent reply other threads:[~2021-09-07 15:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <163090344807.19339.10071205771966144716@noble.neil.brown.name>
2021-09-06 15:46 ` Chuck Lever III
2021-09-06 20:20 ` Matthew Wilcox
2021-09-06 22:13 ` Bruce Fields
2021-09-06 22:22 ` NeilBrown
2021-09-07 0:41 ` NeilBrown
2021-09-07 14:53 ` Chuck Lever III
2021-09-07 15:39 ` Bruce Fields
2021-09-07 15:41 ` Mel Gorman [this message]
2021-09-07 16:21 ` Chuck Lever III
2021-09-07 21:47 ` NeilBrown
2021-09-07 8:17 ` Mel Gorman
2021-09-06 21:52 ` NeilBrown
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=20210907153116.GJ3828@suse.com \
--to=mgorman@suse.com \
--cc=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--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