public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Luis Henriques <lhenriques@suse.de>
To: Ilya Dryomov <idryomov@gmail.com>
Cc: Jeff Layton <jlayton@kernel.org>,
	Ceph Development <ceph-devel@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v2 1/2] ceph: allow schedule_delayed() callers to set delay for workqueue
Date: Tue, 29 Jun 2021 11:53:55 +0100	[thread overview]
Message-ID: <YNr7w3rFH23Ip80b@suse.de> (raw)
In-Reply-To: <CAOi1vP8_x7gEGaKvKMKdGSCzs2OSJNeXPZ_KVLqdg051wpZfYA@mail.gmail.com>

On Tue, Jun 29, 2021 at 12:14:37PM +0200, Ilya Dryomov wrote:
> On Tue, Jun 29, 2021 at 11:47 AM Luis Henriques <lhenriques@suse.de> wrote:
> >
> > Allow schedule_delayed() callers to explicitly set the delay value instead
> > of defaulting to a 5 secs value.
> >
> > Signed-off-by: Luis Henriques <lhenriques@suse.de>
> > ---
> >  fs/ceph/mds_client.c | 19 ++++++++++++-------
> >  1 file changed, 12 insertions(+), 7 deletions(-)
> >
> > diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> > index e5af591d3bd4..08c76bf57fb1 100644
> > --- a/fs/ceph/mds_client.c
> > +++ b/fs/ceph/mds_client.c
> > @@ -4502,13 +4502,18 @@ void inc_session_sequence(struct ceph_mds_session *s)
> >  }
> >
> >  /*
> > - * delayed work -- periodically trim expired leases, renew caps with mds
> > + * delayed work -- periodically trim expired leases, renew caps with mds.  If
> > + * the @delay parameter is set to 0 or if it's more than 5 secs, the default
> > + * workqueue delay value of 5 secs will be used.
> >   */
> > -static void schedule_delayed(struct ceph_mds_client *mdsc)
> > +static void schedule_delayed(struct ceph_mds_client *mdsc, unsigned long delay)
> >  {
> > -       int delay = 5;
> > -       unsigned hz = round_jiffies_relative(HZ * delay);
> > -       schedule_delayed_work(&mdsc->delayed_work, hz);
> > +       unsigned long max_delay = round_jiffies_relative(HZ * 5);
> > +
> > +       /* 5 secs default delay */
> > +       if (!delay || (delay > max_delay))
> > +               delay = max_delay;
> > +       schedule_delayed_work(&mdsc->delayed_work, delay);
> 
> Hi Luis,
> 
> Is there a reason to not round the non-default delay?  Does it need to
> be precise?

Ah, right.  No, there's not reason for not rounding it too.  So, I could
have something like this instead:

	unsigned long max_delay = HZ * 5;

	/* 5 secs default delay */
	if (!delay || (delay > max_delay))
		delay = max_delay;
	schedule_delayed_work(&mdsc->delayed_work, round_jiffies_relative(delay));

I'll make sure v3 will include this change.  Thanks Ilya.

Cheers,
--
Luís

  reply	other threads:[~2021-06-29 10:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29  9:47 [RFC PATCH v2 0/2] ceph_check_delayed_caps() softlockup Luis Henriques
2021-06-29  9:47 ` [RFC PATCH v2 1/2] ceph: allow schedule_delayed() callers to set delay for workqueue Luis Henriques
2021-06-29 10:14   ` Ilya Dryomov
2021-06-29 10:53     ` Luis Henriques [this message]
2021-06-29  9:47 ` [RFC PATCH v2 2/2] ceph: reduce contention in ceph_check_delayed_caps() Luis Henriques

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=YNr7w3rFH23Ip80b@suse.de \
    --to=lhenriques@suse.de \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.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