linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Mike Galbraith <umgwanakikbuti@gmail.com>,
	mingo@kernel.org, torvalds@linux-foundation.org,
	tglx@linutronix.de, ilya.dryomov@inktank.com,
	linux-kernel@vger.kernel.org, Eric Paris <eparis@redhat.com>,
	rafael.j.wysocki@intel.com
Subject: Re: [PATCH 00/11] nested sleeps, fixes and debug infrastructure
Date: Wed, 29 Oct 2014 15:26:54 +0100	[thread overview]
Message-ID: <20141029142654.GD3337@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20141029000055.GA12107@redhat.com>

On Wed, Oct 29, 2014 at 01:00:56AM +0100, Oleg Nesterov wrote:
> On 10/28, Peter Zijlstra wrote:

> > So I talked to Rafael yesterday and I'm going to replace all the
> > wait_event*() stuff, and I suppose also freezable_schedule() because
> > they're racy.
> >
> > The moment we call freezer_do_not_count() the freezer will ignore us,
> > this means the thread could still be running (albeit not for long) when
> > the freezer reports success.
> 
> Yes, sure. IIRC the theory was that a PF_FREEZER_SKIP will do nothing
> "wrong" wrt freezing/suspend before it actually sleeps, but I guess
> today we can't assume this.

Esp. the wait_event_freezable*() family seems suspicious in that the
cond stmt can actually result in quite a lot of code.

But see below, I don't think we have a guarantee it will _ever_ sleep.

Also, this calls schedule(); try_to_freeze() in a suitable loop that's
safe against spurious wakeups, OTOH..

> > Ideally I'll be able to kill the entire freezer_do_not_count() stuff.
> 
> Agreed... but it is not clear to me what exactly we can/should do.

.. I looked at freezable_schedule() and I'm not sure how to 'fix' that.
The problem being things like signal.c:ptrace_stop() that will actually
misbehave in the face of spurious wakeups as allowed by try_to_freeze().

Then again, freezable_schedule() isn't nearly as bad as the
wait_event_freezable() stuff because it does indeed guarantee the task
only calls schedule().

Then again, it is possible to miss these tasks and report freeze success
with a running task all the same, suppose its already woken but
preempted before freezer_count(). The for_each_process_thread() loop in
try_to_freeze_tasks() will skip over it.

And all I can come up with is horrible.. maybe for another day.

  parent reply	other threads:[~2014-10-29 14:27 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24  8:18 [PATCH 00/11] nested sleeps, fixes and debug infrastructure Peter Zijlstra
2014-09-24  8:18 ` [PATCH 01/11] locking/mutex: Dont assume TASK_RUNNING Peter Zijlstra
2014-10-28 11:09   ` [tip:sched/core] locking/mutex: Don't " tip-bot for Peter Zijlstra
2014-09-24  8:18 ` [PATCH 02/11] wait: Provide infrastructure to deal with nested blocking Peter Zijlstra
2014-09-29 21:02   ` Oleg Nesterov
2014-10-02  7:37     ` Peter Zijlstra
2014-10-02 21:21       ` Oleg Nesterov
2014-10-28 11:09   ` [tip:sched/core] sched/wait: " tip-bot for Peter Zijlstra
2014-09-24  8:18 ` [PATCH 03/11] wait: Add might_sleep() Peter Zijlstra
2014-10-28 11:09   ` [tip:sched/core] sched/wait: Add might_sleep() checks tip-bot for Peter Zijlstra
2014-09-24  8:18 ` [PATCH 04/11] exit: Deal with nested sleeps Peter Zijlstra
2014-10-28 11:10   ` [tip:sched/core] sched, " tip-bot for Peter Zijlstra
2014-09-24  8:18 ` [PATCH 05/11] inotify: " Peter Zijlstra
2014-10-28 11:10   ` [tip:sched/core] sched, " tip-bot for Peter Zijlstra
2014-09-24  8:18 ` [PATCH 06/11] tty: " Peter Zijlstra
2014-10-28 11:10   ` [tip:sched/core] sched, " tip-bot for Peter Zijlstra
2014-09-24  8:18 ` [PATCH 07/11] smp: Correctly deal " Peter Zijlstra
2014-10-28 11:11   ` [tip:sched/core] sched, " tip-bot for Peter Zijlstra
2014-09-24  8:18 ` [PATCH 08/11] module: Fix nested sleep Peter Zijlstra
2014-09-29 22:18   ` Oleg Nesterov
2014-09-30 13:43     ` Peter Zijlstra
2014-10-28 11:11   ` [tip:sched/core] sched, modules: Fix nested sleep in add_unformed_module() tip-bot for Peter Zijlstra
2014-09-24  8:18 ` [PATCH 09/11] net: Clean up sk_wait_event() vs might_sleep() Peter Zijlstra
2014-09-24  8:36   ` Peter Zijlstra
2014-10-28 11:11   ` [tip:sched/core] sched, net: Clean up sk_wait_event() vs. might_sleep() tip-bot for Peter Zijlstra
2014-09-24  8:18 ` [PATCH 10/11] sched: Debug nested sleeps Peter Zijlstra
2014-09-29 22:13   ` Oleg Nesterov
2014-09-30 13:49     ` Peter Zijlstra
2014-09-30 21:47       ` Oleg Nesterov
2014-10-01 16:10         ` Peter Zijlstra
2014-10-01 18:35           ` Oleg Nesterov
2014-10-02  9:07             ` Peter Zijlstra
2014-10-02 21:34               ` Oleg Nesterov
2014-10-28 11:11   ` [tip:sched/core] " tip-bot for Peter Zijlstra
2014-09-24  8:18 ` [PATCH 11/11] sched: Exclude cond_resched() from nested sleep test Peter Zijlstra
2014-10-28 11:12   ` [tip:sched/core] " tip-bot for Peter Zijlstra
2014-09-25  8:30 ` [PATCH 00/11] nested sleeps, fixes and debug infrastructure Mike Galbraith
2014-09-25  9:06   ` Peter Zijlstra
2014-09-25  9:10     ` Mike Galbraith
2014-09-25  9:15     ` Peter Zijlstra
2014-09-25  9:56       ` Mike Galbraith
2014-09-25 13:59         ` BUG: sleeping function called from invalid context at drivers/cpufreq/cpufreq.c:370 Mike Galbraith
2014-09-26  6:24           ` Mike Galbraith
2014-09-26  7:54             ` Mike Galbraith
2014-09-26 14:10               ` Rafael J. Wysocki
2014-09-26 22:44               ` Rafael J. Wysocki
2014-09-27  6:14                 ` Mike Galbraith
2014-09-27 19:57                   ` Rafael J. Wysocki
2014-10-02 10:22       ` [PATCH 00/11] nested sleeps, fixes and debug infrastructure Peter Zijlstra
2014-10-02 12:15         ` Peter Zijlstra
2014-10-27 13:41           ` Peter Zijlstra
2014-10-28  0:07             ` Oleg Nesterov
2014-10-28  8:23               ` Peter Zijlstra
2014-10-29  0:00                 ` Oleg Nesterov
2014-10-29  9:35                   ` Peter Zijlstra
2014-10-29 11:31                     ` Peter Zijlstra
2014-10-29 11:36                       ` Peter Zijlstra
2014-10-29 14:26                   ` Peter Zijlstra [this message]
2014-11-04 16:08         ` [tip:sched/core] audit, sched/wait: Fixup kauditd_thread() wait loop tip-bot for Peter Zijlstra

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=20141029142654.GD3337@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=eparis@redhat.com \
    --cc=ilya.dryomov@inktank.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=umgwanakikbuti@gmail.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;
as well as URLs for NNTP newsgroup(s).