From patchwork Mon Apr 23 07:08:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 8011 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 CB55823E49 for ; Mon, 23 Apr 2012 07:10:06 +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 92F33A187DF for ; Mon, 23 Apr 2012 07:10:06 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so22276722iag.11 for ; Mon, 23 Apr 2012 00:10:06 -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=4t1UmmiV7xbLJWIIwrZI86nrbuK0dx/YmrtPQ6GWhzE=; b=dnBwcqrrWfFQSdKqm35gC0tMuJcncL+uqbyv45s2a9urztgpu+NNyXFLjVZNzWbHXq wlcwneJg78NDo75h4peUuJvrwr2oe6BishaKDE76KG5zuFkY/UfTeLqmE5B3iUq5W9Ob VAqdfP51uoUM2XAxxjarICvT+b8w0eZ5O7U0dqdYJeCkBhJQ2Or1JSZst4Zr4ulu+FHf 1Va6a24UJxKuP7zrDeHhJOqZ2m54oGL2yq6IbFjFM1y+XgHu8Qnuk1aStK1/tXNlynNO xDYUWcCoofN7WUzyr9e9AY0PmORk0raY+kT3BIHN84m1hpdL5xUSEkMr0zesfAcIB9zR WLUg== Received: by 10.50.207.38 with SMTP id lt6mr1536201igc.55.1335165006381; Mon, 23 Apr 2012 00:10:06 -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 x6csp91229ibt; Mon, 23 Apr 2012 00:10:06 -0700 (PDT) Received: by 10.60.20.231 with SMTP id q7mr8456802oee.63.1335165005888; Mon, 23 Apr 2012 00:10:05 -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.10.05 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Apr 2012 00:10:05 -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:10:05 -0700 (PDT) Received: by 10.182.36.99 with SMTP id p3mr21147239obj.47.1335165005683; Mon, 23 Apr 2012 00:10:05 -0700 (PDT) Received: from localhost ([69.199.155.45]) by mx.google.com with ESMTPS id m3sm12226009oem.7.2012.04.23.00.10.04 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Apr 2012 00:10:04 -0700 (PDT) Date: Mon, 23 Apr 2012 00:08:49 -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 4/9] sh: Use clear_tasks_mm_cpumask() Message-ID: <20120423070849.GD30752@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: ALoCoQlAKb2ngnDu3+QNcd8LZjGFGGu4Bb+75n+XR2VkGitYEH1OdXwUc/WCrUP/yfsI0WuLVm6C 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 the issue fixed, so let's use it. Suggested-by: Oleg Nesterov Signed-off-by: Anton Vorontsov --- arch/sh/kernel/smp.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c index eaebdf6..4664f76 100644 --- a/arch/sh/kernel/smp.c +++ b/arch/sh/kernel/smp.c @@ -123,7 +123,6 @@ void native_play_dead(void) int __cpu_disable(void) { unsigned int cpu = smp_processor_id(); - struct task_struct *p; int ret; ret = mp_ops->cpu_disable(cpu); @@ -153,11 +152,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; }