From: Chuck Lever III <chuck.lever@oracle.com>
To: Mel Gorman <mgorman@suse.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:21:59 +0000 [thread overview]
Message-ID: <389707DA-96C4-4E99-9487-0603A0FB6FF6@oracle.com> (raw)
In-Reply-To: <20210907153116.GJ3828@suse.com>
> On Sep 7, 2021, at 11:41 AM, Mel Gorman <mgorman@suse.com> wrote:
>
> 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.
True, an allocation failure in svc_alloc_arg() won't cause kernel
instability.
But AFAICS svc_alloc_arg() can't do anything but call again if an
allocation request fails to make forward progress. There really
aren't other options for recovery.
On it's face, svc_alloc_arg() seems to match the "use the flag rather
than opencode [an] endless loop around [the] allocator" comment below.
> 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.
As an aside, there's nothing here that suggests that using NOFAIL would
be risky. And the "no reasonable failure policy" phrasing is a
parenthetical, but it seems to be most pertinent.
IMHO the comment should be updated to match the current implementation
of NOFAIL.
> * Using this flag for costly allocations is _highly_ discouraged
I don't have a preference about using NOFAIL. I think it's a good
idea to base the wait for resources on the availability of those
resources rather than an arbitrary time interval, so I'd like to
see the schedule_timeout() in svc_alloc_arg() replaced with
something smarter.
--
Chuck Lever
next prev parent reply other threads:[~2021-09-07 16:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-06 4:44 [PATCH] SUNRPC: use congestion_wait() in svc_alloc_args() NeilBrown
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
2021-09-07 16:21 ` Chuck Lever III [this message]
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=389707DA-96C4-4E99-9487-0603A0FB6FF6@oracle.com \
--to=chuck.lever@oracle.com \
--cc=bfields@fieldses.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=mgorman@suse.com \
--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;
as well as URLs for NNTP newsgroup(s).