Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752407AbbG3M3W (ORCPT ); Thu, 30 Jul 2015 08:29:22 -0400 Received: from smtprelay0116.hostedemail.com ([216.40.44.116]:49720 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752278AbbG3M3U (ORCPT ); Thu, 30 Jul 2015 08:29:20 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::,RULES_HIT:41:355:379:541:599:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:2898:3138:3139:3140:3141:3142:3352:3622:3865:3867:3868:3870:3872:3873:4321:5007:6120:6261:6742:7901:10004:10226:10400:10848:11026:11232:11658:11914:12043:12296:12438:12517:12519:12740:13069:13311:13357:14096:14097:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: store96_34200fbafc627 X-Filterd-Recvd-Size: 2402 Message-ID: <1438259357.2677.23.camel@perches.com> Subject: Re: [PATCH] improve lmk to avoid deadlock issue From: Joe Perches To: Dan Carpenter Cc: "Wang, Biao" , "gregkh@linuxfoundation.org" , "arve@android.com" , "riandrews@android.com" , "devel@driverdev.osuosl.org" , "Zhang, Di" , "Li, Fei" , "linux-kernel@vger.kernel.org" Date: Thu, 30 Jul 2015 05:29:17 -0700 In-Reply-To: <20150730100937.GM5180@mwanda> References: <09CB0B4607EB8F4DB7E0BE3B06BFBD051DA2DCAB@SHSMSX101.ccr.corp.intel.com> <20150730100937.GM5180@mwanda> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1454 Lines: 44 On Thu, 2015-07-30 at 13:09 +0300, Dan Carpenter wrote: > > diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c [] > > @@ -127,11 +127,15 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) > > if (!p) > > continue; > > > > - if (test_tsk_thread_flag(p, TIF_MEMDIE) && > > - time_before_eq(jiffies, lowmem_deathpending_timeout)) { > > - task_unlock(p); > > - rcu_read_unlock(); > > - return 0; > > + if (test_tsk_thread_flag(p, TIF_MEMDIE)) { > > + if (time_before_eq(jiffies, lowmem_deathpending_timeout)) { > > 5) This goes over the 80 character limit. Could you break it up like > this: > > if (test_tsk_thread_flag(p, TIF_MEMDIE)) { > if (time_before_eq(jiffies, > lowmem_deathpending_timeout)) { > task_unlock(p); > > Anyway, thank for this patch. Please fix these small process issues > and resend. Can the task_unlock in each branch be hoisted? Another way to write this might be to use time_after: if (test_tsk_thread_flag(p, TIF_MEMDIE)) { task_unlock(p); if (time_after(jiffies, lowmem_deathpending_timeout)) continue; rcu_read_unlock(); return 0; } -- 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/