public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: "Luis R. Rodriguez" <mcgrof@kernel.org>
Cc: josh@joshtriplett.org, rostedt@goodmis.org,
	mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com,
	paul.gortmaker@windriver.com, ebiederm@xmission.com,
	dmitry.torokhov@gmail.com, linux-kernel@vger.kernel.org,
	oleg@redhat.com
Subject: Re: [RFC] rcu: use killable versions of swait
Date: Thu, 15 Jun 2017 09:22:01 -0700	[thread overview]
Message-ID: <20170615162201.GB3721@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170615155039.GP27288@wotan.suse.de>

On Thu, Jun 15, 2017 at 05:50:39PM +0200, Luis R. Rodriguez wrote:
> On Wed, Jun 14, 2017 at 04:43:45PM -0700, Paul E. McKenney wrote:
> > On Wed, Jun 14, 2017 at 04:06:39PM -0700, Luis R. Rodriguez wrote:
> > > These waits don't even check for the return value for interruption,
> > > using the non-killable variants means we could be killed by other
> > > signals than SIGKILL, this is fragile.
> > 
> > A number of people asserted that kthreads could never catch signals.
> > I checked this at the time, and it seemed like this was the case, and
> > the call to ignore_signals() seems to confirm this.
> > 
> > So it looks to me like RCU doesn't care about this change (give or
> > take any affect on the load average, anyway), but there is much that I
> > don't know about Linux-kernel signal handling, so please feel free to
> > educate me.
> 
> Thanks, I had seen the kthread but figured best to ask, just got into parnaoia
> mode. If we were to do a sanity check for usage we'd then have to white list
> when kthreads are used, however since we don't care to be interrupted why not
> use a wait which is also explicit about our current uninterruptible state?

I do appreciate any and all inspection, actually, so thank you!

I used to have it uninterruptable, but got complaints on the effect on
the load average -- sysadms didn't like the "D" state and the fact that
the load average was always greater than 2 (or 3 on PREEMPT=y kernels)
when the system was completely idle.

> > > Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> > > ---
> > > 
> > > The killable swaits were just posted [1] as part of a series where SIGCHLD
> > > was detected as interrupting and killing kernel calls waiting using
> > > non-killable swaits [1]. The fragility here made curious about other callers
> > > and seeing if they really meant to use such broad wait which captures a lot
> > > of signals.
> > > 
> > > I can't see why we'd want to have these killed by other signals, specialy
> > > since it seems we don't even check for the return value... Granted to abort
> > > properly we'd have to check for the return value for -ERESTARTSYS, but yeah,
> > > none of this is done, so it would seem we don't want fragile signals
> > > interrupting these ?
> > 
> > The later WARN_ON(signal_pending(current)) complains if a signal somehow
> > makes it to this task.  Assuming that the signal is nonfatal, anyway.
> 
> I see, how about just using swait_event_timeout() and removing the WARN_ON()?
> Is there a reason for having the interruptible ?

If sleeping-uninterruptible kthreads are now excluded from the load average,
no reason.  But if sleeping-uninterruptible kthreads are still included in
the load average, it must stay interruptible.

> > > Also can someone confirm if the original change of to swait_event_timeout()
> > > from wait_event_interruptible_timeout() was actually intentional on
> > > synchronize_sched_expedited_wait() on commit abedf8e2419fb ("rcu: Use simple
> > > wait queues where possible in rcutree") ? I can't easily confirm.
> > 
> > This is also called from a workqueue (at least once the core_initcall()s
> > get done), which again should mean no signals.  A WARN_ON(ret < 0)
> > complains if this ever changes.  So it should be OK that this is
> > swait_event_timeout().  And expedited grace periods are supposed to
> > get done quickly, so effect on the load average should be negligible.
> 
> Great thanks.
> 
> > Or am I missing something?
> 
> No, just got into parnoia mode and better to ask than be sorry later!

Indeed, better safe that sorry!

							Thanx, Paul

  reply	other threads:[~2017-06-15 16:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14 23:06 [RFC] rcu: use killable versions of swait Luis R. Rodriguez
2017-06-14 23:43 ` Paul E. McKenney
2017-06-15 15:50   ` Luis R. Rodriguez
2017-06-15 16:22     ` Paul E. McKenney [this message]
2017-06-15 16:35       ` Luis R. Rodriguez
2017-06-15 16:55         ` Eric W. Biederman
2017-06-15 18:48           ` [RFC v2 0/2] swait: add idle to make idle-hacks on kthreads explicit Luis R. Rodriguez
2017-06-15 18:48             ` [RFC v2 1/2] swait: add idle variants which don't contribute to load average Luis R. Rodriguez
2017-06-16  0:47               ` Boqun Feng
2017-06-20 21:32                 ` Luis R. Rodriguez
2017-06-16 20:31               ` Eric W. Biederman
2017-06-19 17:53                 ` Paul E. McKenney
2017-06-15 18:48             ` [RFC v2 2/2] rcu: use idle versions of swait to make idle-hack clear Luis R. Rodriguez
2017-06-15 21:57             ` [RFC v2 0/2] swait: add idle to make idle-hacks on kthreads explicit Paul E. McKenney
2017-06-15 23:26               ` Luis R. Rodriguez
2017-06-15 23:43                 ` Paul E. McKenney
2017-06-16 20:37                   ` Eric W. Biederman
2017-06-19 17:54                     ` Paul E. McKenney
2017-06-20 21:45             ` [PATCH " Luis R. Rodriguez
2017-06-20 21:45               ` [PATCH 1/2] swait: add idle variants which don't contribute to load average Luis R. Rodriguez
2017-06-20 21:45               ` [PATCH 2/2] rcu: use idle versions of swait to make idle-hack clear Luis R. Rodriguez
2017-06-21 16:48               ` [PATCH 0/2] swait: add idle to make idle-hacks on kthreads explicit Paul E. McKenney
2017-06-21 17:57                 ` Luis R. Rodriguez
2017-06-21 18:19                   ` Paul E. McKenney
2017-06-15 17:34         ` [RFC] rcu: use killable versions of swait Paul E. McKenney

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=20170615162201.GB3721@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=ebiederm@xmission.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mcgrof@kernel.org \
    --cc=oleg@redhat.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=rostedt@goodmis.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