linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "NeilBrown" <neilb@suse.de>
To: "Chuck Lever III" <chuck.lever@oracle.com>
Cc: "Bruce Fields" <bfields@fieldses.org>,
	"Linux NFS Mailing List" <linux-nfs@vger.kernel.org>,
	"Mel Gorman" <mgorman@suse.com>, "Linux-MM" <linux-mm@kvack.org>
Subject: Re: [PATCH] SUNRPC: use congestion_wait() in svc_alloc_args()
Date: Tue, 07 Sep 2021 07:52:07 +1000	[thread overview]
Message-ID: <163096512753.2518.2763320775379374551@noble.neil.brown.name> (raw)
In-Reply-To: <848A6498-CFF3-4C66-AE83-959F8221E930@oracle.com>

On Tue, 07 Sep 2021, Chuck Lever III wrote:
> Hi Neil-
> 
> > On Sep 6, 2021, at 12:44 AM, NeilBrown <neilb@suse.de> wrote:
> > 
> > 
> > Many places that need to wait before retrying a memory allocation use
> > congestion_wait().  xfs_buf_alloc_pages() is a good example which
> > follows a similar pattern to that in svc_alloc_args().
> > 
> > It make sense to do the same thing in svc_alloc_args(); This will allow
> > the allocation to be retried sooner if some backing device becomes
> > non-congested before the timeout.
> > 
> > Every call to congestion_wait() in the entire kernel passes BLK_RW_ASYNC
> > as the first argument, so we should so.
> > 
> > The second argument - an upper limit for waiting - seem fairly
> > arbitrary.  Many places use "HZ/50" or "HZ/10".  As there is no obvious
> > choice, it seems reasonable to leave the maximum time unchanged.
> > 
> > If a service using svc_alloc_args() is terminated, it may now have to
> > wait up to the full 500ms before termination completes as
> > congestion_wait() cannot be interrupted.  I don't believe this will be a
> > problem in practice, though it might be justification for using a
> > smaller timeout.
> > 
> > Signed-off-by: NeilBrown <neilb@suse.de>
> > ---
> > 
> > I happened to notice this inconsistency between svc_alloc_args() and
> > xfs_buf_alloc_pages() despite them doing very similar things, so thought
> > I'd send a patch.
> > 
> > NeilBrown
> 
> When we first considered the alloc_pages_bulk() API, the SUNRPC
> patch in that series replaced this schedule_timeout(). Mel
> suggested we postpone that to a separate patch. Now is an ideal
> time to consider this change again. I've added the MM folks for
> expert commentary.
> 
> I would rather see a shorter timeout, since that will be less
> disruptive in practice and today's systems shouldn't have to wait
> that long for free memory to become available. DEFAULT_IO_TIMEOUT
> might be a defensible choice -- it will slow down this loop
> effectively without adding a significant delay.

DEFAULT_IO_TIMEOUT is local to f2fs, so might not be the best choice.
I could be comfortable with any number from 1 to HZ, and have no basis
on how to make a choice - which is why I deliberately avoided making
one.
Ideally, the full timeout would (almost) never expire in practice.
Ideally, the interface would not even ask that we supply a timeout.
But are not currently at the ideal ;-(

Thanks,
NeilBrown


      parent reply	other threads:[~2021-09-06 21:52 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
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 [this message]

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=163096512753.2518.2763320775379374551@noble.neil.brown.name \
    --to=neilb@suse.de \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=mgorman@suse.com \
    /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