mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Hogan <james.hogan@imgtec.com>
To: <linux-kernel@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	James Hogan <james.hogan@imgtec.com>,
	"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
	Oleg Nesterov <oleg@redhat.com>,
	"Anton Vorontsov" <anton.vorontsov@linaro.org>
Subject: [PATCH 1/5] metag: use clear_tasks_mm_cpumask()
Date: Mon, 1 Jul 2013 17:04:15 +0100	[thread overview]
Message-ID: <1372694659-30176-2-git-send-email-james.hogan@imgtec.com> (raw)
In-Reply-To: <1372694659-30176-1-git-send-email-james.hogan@imgtec.com>

Checking for process->mm is not enough because process' main thread may
exit or detach its mm via use_mm(), but other threads may still have a
valid mm.

To fix this we would need to use find_lock_task_mm(), which would walk
up all threads and returns an appropriate task (with task lock held).

clear_tasks_mm_cpumask() was introduced in v3.5-rc1 to fix this issue,
so let's use it for metag too.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Anton Vorontsov <anton.vorontsov@linaro.org>
---
 arch/metag/kernel/smp.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/metag/kernel/smp.c b/arch/metag/kernel/smp.c
index 86fdda4..b813515 100644
--- a/arch/metag/kernel/smp.c
+++ b/arch/metag/kernel/smp.c
@@ -276,7 +276,6 @@ static DECLARE_COMPLETION(cpu_killed);
 int __cpuexit __cpu_disable(void)
 {
 	unsigned int cpu = smp_processor_id();
-	struct task_struct *p;
 
 	/*
 	 * Take this CPU offline.  Once we clear this, we can't return,
@@ -296,12 +295,7 @@ int __cpuexit __cpu_disable(void)
 	flush_cache_all();
 	local_flush_tlb_all();
 
-	read_lock(&tasklist_lock);
-	for_each_process(p) {
-		if (p->mm)
-			cpumask_clear_cpu(cpu, mm_cpumask(p->mm));
-	}
-	read_unlock(&tasklist_lock);
+	clear_tasks_mm_cpumask(cpu);
 
 	return 0;
 }
-- 
1.8.1.2



  reply	other threads:[~2013-07-01 16:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-01 16:04 [PATCH 0/5] metag: smp/hotplug fixes James Hogan
2013-07-01 16:04 ` James Hogan [this message]
2013-07-01 16:04 ` [PATCH 2/5] metag: smp: enable irqs after set_cpu_online James Hogan
2013-07-01 21:42   ` Thomas Gleixner
2013-07-02  5:57   ` Srivatsa S. Bhat
2013-07-01 16:04 ` [PATCH 3/5] metag: smp: don't spin waiting for CPU to start James Hogan
2013-07-01 21:46   ` Thomas Gleixner
2013-07-01 22:02     ` James Hogan
2013-07-02  6:12   ` Srivatsa S. Bhat
2013-07-01 16:04 ` [PATCH 4/5] metag: kick: prevent nested kick handlers James Hogan
2013-07-01 21:51   ` Thomas Gleixner
2013-07-01 22:17     ` James Hogan
2013-07-01 22:56       ` Thomas Gleixner
2013-07-02  0:00         ` James Hogan
2013-07-01 16:04 ` [PATCH 5/5] metag: cpu hotplug: route_irq: preserve irq mask James Hogan
2013-07-01 21:51   ` Thomas Gleixner
2013-07-02  6:16   ` Srivatsa S. Bhat
2013-07-02  9:59     ` James Hogan

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=1372694659-30176-2-git-send-email-james.hogan@imgtec.com \
    --to=james.hogan@imgtec.com \
    --cc=anton.vorontsov@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --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®