mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Nicholas Mc Guire <der.herr@hofr.at>
Cc: linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	tglx@linutronix.de,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH RT] drop migrate_disabled section in _cpu_down
Date: Mon, 24 Mar 2014 10:20:29 -0400	[thread overview]
Message-ID: <20140324102029.48350386@gandalf.local.home> (raw)
In-Reply-To: <20140324122025.GB18300@opentech.at>

On Mon, 24 Mar 2014 13:20:25 +0100
Nicholas Mc Guire <der.herr@hofr.at> wrote:

> HI !
> 
> 
> Minor cleanup: drop unnecessary migrate_disable in _cpu_down
> 
> in kernel/cpu.c:_cpu_down
>     ...
>     cpumask_andnot(cpumask, cpu_online_mask, cpumask_of(cpu));
>     set_cpus_allowed_ptr(current, cpumask);
>     ...
>     migrate_disable();
>     mycpu = smp_processor_id();
>     if (mycpu == cpu) {
>             printk(KERN_ERR "Yuck! Still on unplug CPU\n!");
>             migrate_enable();
>             err = -EBUSY;
>             goto restore_cpus;
>     }
>     migrate_enable();
> 
> If we got migrated off "cpu" then we can not get migrate
> back as the cpus_allowed was updated. so if smp_processor_id(); returns
> anything != cpu we are fine even if migrated off to a third cpu between
> the mycpu = smp_processor_id() and the if (mycpu == cpu). No need for
> migration protection here.
> 
> Further the migrate disable is effectively only needed for the condition
> check in the if statement - so I think it could be replaced by:
> 
>     if (cpu==smp_processor_id()) {
>             pr_err("Yuck! Still on unplug CPU\n!");
>             err = -EBUSY;
>             goto restore_cpus;
>     }
> 
> even in the case that the cpus_allowed had not been updated.
> 
> Patch is against 3.12.13-rt21

This is checking for an anomaly, and it's in a very slow path. I feel
more comfortable with keeping the code as is, than to change it for a
micro optimization.

-- Steve


> 
> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>

      reply	other threads:[~2014-03-24 14:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-24 12:20 Nicholas Mc Guire
2014-03-24 14:20 ` Steven Rostedt [this message]

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=20140324102029.48350386@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=bigeasy@linutronix.de \
    --cc=der.herr@hofr.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=peterz@infradead.org \
    --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

all inboxes | Powered by JetHome®