mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC][PATCH] sched: take rt_rq->rt_runtime_lock around rt_rq->rt_runtime modification
@ 2011-07-28 20:13 Jesper Juhl
  2011-07-28 21:13 ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Jesper Juhl @ 2011-07-28 20:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Peter Zijlstra

Everywhere (that I could find) where we modify rt_rq->rt_runtime we hold 
rt_rq->rt_runtime_lock except in alloc_rt_sched_group(). Shouldn't we do 
so - as per this patch. ???

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 kernel/sched.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index ccacdbd..d5a3737 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -8488,7 +8488,9 @@ int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
 			goto err_free_rq;
 
 		init_rt_rq(rt_rq, cpu_rq(i));
+		raw_spin_lock(&rt_rq->rt_runtime_lock);
 		rt_rq->rt_runtime = tg->rt_bandwidth.rt_runtime;
+		raw_spin_unlock(&rt_rq->rt_runtime_lock);
 		init_tg_rt_entry(tg, rt_rq, rt_se, i, parent->rt_se[i]);
 	}
 
-- 
1.7.6


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC][PATCH] sched: take rt_rq->rt_runtime_lock around rt_rq->rt_runtime modification
  2011-07-28 20:13 [RFC][PATCH] sched: take rt_rq->rt_runtime_lock around rt_rq->rt_runtime modification Jesper Juhl
@ 2011-07-28 21:13 ` Peter Zijlstra
  2011-07-28 21:14   ` Jesper Juhl
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2011-07-28 21:13 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-kernel, Ingo Molnar

On Thu, 2011-07-28 at 22:13 +0200, Jesper Juhl wrote:
> Everywhere (that I could find) where we modify rt_rq->rt_runtime we hold 
> rt_rq->rt_runtime_lock except in alloc_rt_sched_group(). Shouldn't we do 
> so - as per this patch. ???
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
>  kernel/sched.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/sched.c b/kernel/sched.c
> index ccacdbd..d5a3737 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -8488,7 +8488,9 @@ int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
>  			goto err_free_rq;
>  
>  		init_rt_rq(rt_rq, cpu_rq(i));
> +		raw_spin_lock(&rt_rq->rt_runtime_lock);
>  		rt_rq->rt_runtime = tg->rt_bandwidth.rt_runtime;
> +		raw_spin_unlock(&rt_rq->rt_runtime_lock);
>  		init_tg_rt_entry(tg, rt_rq, rt_se, i, parent->rt_se[i]);

This is init code, the rt_rq is fresh and isn't exposed yet. There isn't
any concurrency.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC][PATCH] sched: take rt_rq->rt_runtime_lock around rt_rq->rt_runtime modification
  2011-07-28 21:13 ` Peter Zijlstra
@ 2011-07-28 21:14   ` Jesper Juhl
  0 siblings, 0 replies; 3+ messages in thread
From: Jesper Juhl @ 2011-07-28 21:14 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: linux-kernel, Ingo Molnar

On Thu, 28 Jul 2011, Peter Zijlstra wrote:

> On Thu, 2011-07-28 at 22:13 +0200, Jesper Juhl wrote:
> > Everywhere (that I could find) where we modify rt_rq->rt_runtime we hold 
> > rt_rq->rt_runtime_lock except in alloc_rt_sched_group(). Shouldn't we do 
> > so - as per this patch. ???
> > 
> > Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> > ---
> >  kernel/sched.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/kernel/sched.c b/kernel/sched.c
> > index ccacdbd..d5a3737 100644
> > --- a/kernel/sched.c
> > +++ b/kernel/sched.c
> > @@ -8488,7 +8488,9 @@ int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
> >  			goto err_free_rq;
> >  
> >  		init_rt_rq(rt_rq, cpu_rq(i));
> > +		raw_spin_lock(&rt_rq->rt_runtime_lock);
> >  		rt_rq->rt_runtime = tg->rt_bandwidth.rt_runtime;
> > +		raw_spin_unlock(&rt_rq->rt_runtime_lock);
> >  		init_tg_rt_entry(tg, rt_rq, rt_se, i, parent->rt_se[i]);
> 
> This is init code, the rt_rq is fresh and isn't exposed yet. There isn't
> any concurrency.
> 

I was actually wondering if that was the case, but wasn't sure, so I 
thought - better safe than sorry and ask :-)

Thank you for the feedback.

-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-28 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-28 20:13 [RFC][PATCH] sched: take rt_rq->rt_runtime_lock around rt_rq->rt_runtime modification Jesper Juhl
2011-07-28 21:13 ` Peter Zijlstra
2011-07-28 21:14   ` Jesper Juhl

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®