Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755888Ab2BFVhA (ORCPT ); Mon, 6 Feb 2012 16:37:00 -0500 Received: from mail-gy0-f174.google.com ([209.85.160.174]:59449 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755869Ab2BFVg5 convert rfc822-to-8bit (ORCPT ); Mon, 6 Feb 2012 16:36:57 -0500 MIME-Version: 1.0 In-Reply-To: <20120206162947.GD5117@oksana.dev.rtsoft.ru> References: <20120203163056.GA4190@redhat.com> <20120206162947.GD5117@oksana.dev.rtsoft.ru> From: KOSAKI Motohiro Date: Mon, 6 Feb 2012 16:36:37 -0500 Message-ID: Subject: Re: [PATCH 4/6] staging: android/lowmemorykiller: Better mm handling To: Anton Vorontsov Cc: Oleg Nesterov , Greg KH , =?ISO-8859-1?Q?Arve_Hj=F8nnev=E5g?= , San Mehat , Colin Cross , "Eric W. Biederman" , "Paul E. McKenney" , linux-kernel@vger.kernel.org, kernel-team@android.com, linaro-kernel@lists.linaro.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1630 Lines: 46 > ?static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) > ?{ > - ? ? ? struct task_struct *p; > + ? ? ? struct task_struct *tsk; > ? ? ? ?struct task_struct *selected = NULL; > ? ? ? ?int rem = 0; > ? ? ? ?int tasksize; > @@ -134,15 +134,17 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) > ? ? ? ?selected_oom_adj = min_adj; > > ? ? ? ?rcu_read_lock(); > - ? ? ? for_each_process(p) { > - ? ? ? ? ? ? ? struct mm_struct *mm; > + ? ? ? for_each_process(tsk) { > + ? ? ? ? ? ? ? struct task_struct *p; > ? ? ? ? ? ? ? ?struct signal_struct *sig; > ? ? ? ? ? ? ? ?int oom_adj; > > - ? ? ? ? ? ? ? task_lock(p); > - ? ? ? ? ? ? ? mm = p->mm; > + ? ? ? ? ? ? ? p = find_lock_task_mm(tsk); > + ? ? ? ? ? ? ? if (!p) > + ? ? ? ? ? ? ? ? ? ? ? continue; > + > ? ? ? ? ? ? ? ?sig = p->signal; > - ? ? ? ? ? ? ? if (!mm || !sig) { > + ? ? ? ? ? ? ? if (!sig) { > ? ? ? ? ? ? ? ? ? ? ? ?task_unlock(p); > ? ? ? ? ? ? ? ? ? ? ? ?continue; > ? ? ? ? ? ? ? ?} > @@ -151,7 +153,7 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) > ? ? ? ? ? ? ? ? ? ? ? ?task_unlock(p); > ? ? ? ? ? ? ? ? ? ? ? ?continue; > ? ? ? ? ? ? ? ?} > - ? ? ? ? ? ? ? tasksize = get_mm_rss(mm); > + ? ? ? ? ? ? ? tasksize = get_mm_rss(p->mm); > ? ? ? ? ? ? ? ?task_unlock(p); > ? ? ? ? ? ? ? ?if (tasksize <= 0) > ? ? ? ? ? ? ? ? ? ? ? ?continue; ack. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/