mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Xiaotian feng <dfeng@redhat.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH -tip v2] sched: more sched_domain iterations fix
Date: Tue, 26 Apr 2011 11:27:19 +0200	[thread overview]
Message-ID: <1303810039.20212.221.camel@twins> (raw)
In-Reply-To: <1303469634-11678-1-git-send-email-dfeng@redhat.com>

On Fri, 2011-04-22 at 18:53 +0800, Xiaotian feng wrote:
> From: Xiaotian Feng <dfeng@redhat.com>
> 
> sched_domain iterations needs to be protected by rcu_read_lock() now,
> this patch adds another two places which needs the rcu lock, which is
> spotted by following suspicious rcu_dereference_check() usage warnings.
> 
> kernel/sched_rt.c:1244 invoked rcu_dereference_check() without protection!
> kernel/sched_stats.h:41 invoked rcu_dereference_check() without protection!

Much better, one worry:

> Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Peter Zijlstra <peterz@infradead.org>
> ---

> diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h
> index 48ddf43..331e01b 100644
> --- a/kernel/sched_stats.h
> +++ b/kernel/sched_stats.h
> @@ -37,7 +37,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
>  
>  #ifdef CONFIG_SMP
>  		/* domain-specific stats */
> -		preempt_disable();
> +		rcu_read_lock();
>  		for_each_domain(cpu, sd) {
>  			enum cpu_idle_type itype;
>  
> @@ -64,7 +64,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
>  			    sd->ttwu_wake_remote, sd->ttwu_move_affine,
>  			    sd->ttwu_move_balance);
>  		}
> -		preempt_enable();
> +		rcu_read_unlock();
>  #endif
>  	}
>  	kfree(mask_str);

Did you indeed validate that the preempt_disable() wasn't needed for
anything else? Your changelog doesn't mention and I didn't check, just
noticed the possibility on the first posting.

  reply	other threads:[~2011-04-26  9:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-21 11:07 [PATCH -tip] " Xiaotian Feng
2011-04-21 11:21 ` Peter Zijlstra
2011-04-22 10:53   ` [PATCH -tip v2] " Xiaotian feng
2011-04-26  9:27     ` Peter Zijlstra [this message]
2011-04-26 10:40       ` Xiaotian Feng
2011-05-28 16:34     ` [tip:sched/urgent] sched: More sched_domain iterations fixes tip-bot for Xiaotian Feng

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=1303810039.20212.221.camel@twins \
    --to=peterz@infradead.org \
    --cc=dfeng@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®