From patchwork Mon Apr 23 07:08:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 8009 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9C83623E49 for ; Mon, 23 Apr 2012 07:09:45 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 64F05A187EB for ; Mon, 23 Apr 2012 07:09:45 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so22276722iag.11 for ; Mon, 23 Apr 2012 00:09:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:date:from :to:cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent:x-gm-message-state; bh=TuWBkq/9uc4nnhXo4KVfwLunmAV6gbwHOcRmweYRGyU=; b=YetjOkSANZSQ/zcYN5BLWWE76i+rPo7NAn5xuYumnoeRIRx4pktLH5vN8eq1ORgu2Q vC1nfRxrolDWf1GNouryI02gp5DllmeNr1rEMQUzsvYAqPDdJVY7JhWGP7oDZD+X01sk ckdkDdn2r41WfadsdklMxFjh3iEFX/4PHjvIE8cAkDc12ZhTxBZKQvk11azNAg49R4+d CW2d7m6+goo0SRuxG+fTghPkHiEBZzEYVemjz1NqXN3I/63J3gm30AxjrbKKPbHo2kgB jJJW/O6rLWiVO2ADmXRzMADXnuW/k5xc25j1KXvVptSE+YXB7rrAIlNMwvOc66eGBMZU 4gxg== Received: by 10.42.80.19 with SMTP id t19mr1282310ick.55.1335164985123; Mon, 23 Apr 2012 00:09:45 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.137.198 with SMTP id x6csp91210ibt; Mon, 23 Apr 2012 00:09:44 -0700 (PDT) Received: by 10.60.20.231 with SMTP id q7mr8455588oee.63.1335164984625; Mon, 23 Apr 2012 00:09:44 -0700 (PDT) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by mx.google.com with ESMTPS id k9si7123921obd.140.2012.04.23.00.09.44 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Apr 2012 00:09:44 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.214.178 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.214.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.214.178 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) smtp.mail=anton.vorontsov@linaro.org Received: by mail-ob0-f178.google.com with SMTP id wc18so9042020obb.37 for ; Mon, 23 Apr 2012 00:09:44 -0700 (PDT) Received: by 10.60.18.198 with SMTP id y6mr5544574oed.38.1335164984486; Mon, 23 Apr 2012 00:09:44 -0700 (PDT) Received: from localhost ([69.199.155.45]) by mx.google.com with ESMTPS id qa9sm9322120obc.17.2012.04.23.00.09.42 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Apr 2012 00:09:43 -0700 (PDT) Date: Mon, 23 Apr 2012 00:08:28 -0700 From: Anton Vorontsov To: Andrew Morton , Oleg Nesterov Cc: Russell King , Mike Frysinger , Benjamin Herrenschmidt , Richard Weinberger , Paul Mundt , Peter Zijlstra , KOSAKI Motohiro , John Stultz , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, uclinux-dist-devel@blackfin.uclinux.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, user-mode-linux-devel@lists.sourceforge.net, linaro-kernel@lists.linaro.org, patches@linaro.org, linux-mm@kvack.org Subject: [PATCH 2/9] arm: Use clear_tasks_mm_cpumask() Message-ID: <20120423070828.GB30752@lizard> References: <20120423070641.GA27702@lizard> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120423070641.GA27702@lizard> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQlsPeJBKh7BLUbzTQsqjXUhhW1E1sp+o3mqQCYjZ9AaSNLnGCEi9gy4NqJbvoYX4xmxA5Gb 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() has this issue fixed, so let's use it. Suggested-by: Oleg Nesterov Signed-off-by: Anton Vorontsov --- arch/arm/kernel/smp.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index addbbe8..e824ee4 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -130,7 +130,6 @@ static void percpu_timer_stop(void); int __cpu_disable(void) { unsigned int cpu = smp_processor_id(); - struct task_struct *p; int ret; ret = platform_cpu_disable(cpu); @@ -160,12 +159,7 @@ int __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; }