linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Mc Guire <der.herr@hofr.at>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-rt-users@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Andreas Platschek <platschek@ict.tuwien.ac.at>
Subject: Re: [PATCH] allow preemption in recursive migrate_disable call
Date: Sat, 23 Nov 2013 06:19:25 +0100	[thread overview]
Message-ID: <20131123051925.GA9730@opentech.at> (raw)
In-Reply-To: <20131121101913.GZ10022@twins.programming.kicks-ass.net>

On Thu, 21 Nov 2013, Peter Zijlstra wrote:

> On Wed, Nov 20, 2013 at 01:33:33AM +0100, Nicholas Mc Guire wrote:
> > From a7259c360b6c8b873f5fcf6d5eed0ae78534a6c5 Mon Sep 17 00:00:00 2001
> > From: Nicholas Mc Guire <der.herr@hofr.at>
> > Date: Wed, 20 Nov 2013 07:22:09 +0800
> > Subject: [PATCH] allow preemption in recursive migrate_disable call
> > 
> >  Minor cleanup in migrate_disable/migrate_enable. The recursive case
> >  does not need to disable preemption as it is "pinned" to the current
> >  cpu any way so it is safe to preempt it.
> > 
> >  No functional change to migrate_disable/enable
> > 
> > Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
> > ---
> >  kernel/sched/core.c |    6 ++----
> >  1 files changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index a7fafc28..22fa2e2 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -2418,13 +2418,12 @@ void migrate_disable(void)
> >  	}
> >  #endif
> >  
> > -	preempt_disable();
> >  	if (p->migrate_disable) {
> >  		p->migrate_disable++;
> > -		preempt_enable();
> >  		return;
> >  	}
> >  
> > +	preempt_disable();
> >  	preempt_lazy_disable();
> >  	pin_current_cpu();
> >  	p->migrate_disable = 1;
> > @@ -2454,13 +2453,12 @@ void migrate_enable(void)
> >  #endif
> >  	WARN_ON_ONCE(p->migrate_disable <= 0);
> >  
> > -	preempt_disable();
> >  	if (migrate_disable_count(p) > 1) {
> >  		p->migrate_disable--;
> > -		preempt_enable();
> >  		return;
> >  	}
> >  
> > +	preempt_disable();
> >  	if (unlikely(migrate_disabled_updated(p))) {
> >  		/*
> >  		 * Undo whatever update_migrate_disable() did, also see there
> 
> Is there a reason one uses p->migrate_disable and the other uses
> migrate_disable_count(p) ? 
>
in the update case incrementting is fine with or without 
MIGRATE_DISABLE_SET_AFFIN set, in the migrate_enable case though
if the nesting level were actuall 1 and MIGRATE_DISABLE_SET_AFFIN were set
we would end up in the wrong branch (1<<30)+1 > 1.

thx!
hofrat

  parent reply	other threads:[~2013-11-23  5:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20  0:33 [PATCH] allow preemption in recursive migrate_disable call Nicholas Mc Guire
2013-11-21 10:19 ` Peter Zijlstra
2013-11-22 15:51   ` Sebastian Andrzej Siewior
2013-11-23  5:19   ` Nicholas Mc Guire [this message]
2013-11-22 17:37 ` Sebastian Andrzej Siewior

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=20131123051925.GA9730@opentech.at \
    --to=der.herr@hofr.at \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=platschek@ict.tuwien.ac.at \
    --cc=tglx@linutronix.de \
    /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).