All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: John Stultz <john.stultz@linaro.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Ingo Molnar" <mingo@elte.hu>
Subject: Re: [PATCH 1/5] sched: Enable might_sleep before initializing drivers.
Date: Sat, 20 Nov 2010 11:42:35 +0100	[thread overview]
Message-ID: <1290249755.2118.0.camel@laptop> (raw)
In-Reply-To: <1290218934-8544-2-git-send-email-john.stultz@linaro.org>

On Fri, 2010-11-19 at 18:08 -0800, John Stultz wrote:
> From: Arve Hjønnevåg <arve@android.com>
> 
> This allows detection of init bugs in built-in drivers.
> 
> CC: Ingo Molnar <mingo@elte.hu>
> CC: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Arve Hjønnevåg <arve@android.com>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
>  kernel/sched.c |   13 ++++++++++++-
>  1 files changed, 12 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/sched.c b/kernel/sched.c
> index aa14a56..0b58415 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -8104,13 +8104,24 @@ static inline int preempt_count_equals(int preempt_offset)
>  	return (nested == PREEMPT_INATOMIC_BASE + preempt_offset);
>  }
>  
> +static int __might_sleep_init_called;
> +int __init __might_sleep_init(void)
> +{
> +	__might_sleep_init_called = 1;
> +	return 0;
> +}
> +early_initcall(__might_sleep_init);
> +
>  void __might_sleep(const char *file, int line, int preempt_offset)
>  {
>  #ifdef in_atomic
>  	static unsigned long prev_jiffy;	/* ratelimiting */
>  
>  	if ((preempt_count_equals(preempt_offset) && !irqs_disabled()) ||
> -	    system_state != SYSTEM_RUNNING || oops_in_progress)
> +	    oops_in_progress)
> +		return;
> +	if (system_state != SYSTEM_RUNNING &&
> +	    (!__might_sleep_init_called || system_state != SYSTEM_BOOTING))
>  		return;
>  	if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
>  		return;

Remind me, why isn't scheduler_running good enough?

  reply	other threads:[~2010-11-20 10:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-20  2:08 [PATCH 0/5] [RFC] Trivial scheduler related Android patches John Stultz
2010-11-20  2:08 ` [PATCH 1/5] sched: Enable might_sleep before initializing drivers John Stultz
2010-11-20 10:42   ` Peter Zijlstra [this message]
2010-11-20  2:08 ` [PATCH 2/5] sched: make task dump print all 15 chars of proc comm John Stultz
2010-11-23 10:21   ` [tip:sched/core] sched: Make " tip-bot for Erik Gilling
2010-11-20  2:08 ` [PATCH 3/5] scheduler: cpuacct: Enable platform hooks to track cpuusage for CPU frequencies John Stultz
2010-11-20 10:48   ` Peter Zijlstra
2010-11-22  5:51     ` Florian Mickler
2010-11-22 10:43       ` Peter Zijlstra
2010-11-22 12:23         ` Florian Mickler
2010-11-23  2:05           ` Mike Chan
2010-11-23 11:35             ` Peter Zijlstra
2010-11-20  2:08 ` [PATCH 4/5] scheduler: cpuacct: Enable platform callbacks for cpuacct power tracking John Stultz
2010-11-20  2:08 ` [PATCH 5/5] sched: use the old min_vruntime when normalizing on dequeue John Stultz
2010-11-20 10:55   ` Peter Zijlstra
2010-11-20 12:33     ` 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=1290249755.2118.0.camel@laptop \
    --to=peterz@infradead.org \
    --cc=arve@android.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.