From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754243AbcIAVN3 (ORCPT ); Thu, 1 Sep 2016 17:13:29 -0400 Received: from smtprelay0061.hostedemail.com ([216.40.44.61]:41692 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757052AbcIAVIu (ORCPT ); Thu, 1 Sep 2016 17:08:50 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:41:355:379:541:599:960:966:967:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1543:1593:1594:1605:1711:1730:1747:1777:1792:2196:2199:2393:2525:2553:2560:2563:2682:2685:2828:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4385:5007:7875:7903:9025:10004:10400:10848:11026:11232:11473:11658:11783:11914:12043:12295:12296:12438:12740:13439:13894:14181:14659:14721:21080:30054:30070:30090:30091,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,LFtime:3,LUA_SUMMARY:none X-HE-Tag: joke90_35110ac91ca4d X-Filterd-Recvd-Size: 4735 Message-ID: <1472755363.4176.128.camel@perches.com> Subject: Re: [PATCH] staging: android: lowmemorykiller.c: Fix checkpatch warning From: Joe Perches To: Greg Kroah-Hartman Cc: Andrey Utkin , Anson Jacob , Staging List , arve@android.com, riandrews@android.com, Kernel List Date: Thu, 01 Sep 2016 11:42:43 -0700 In-Reply-To: <20160901183310.GA7470@kroah.com> References: <20160825151025.GA4399@X250> <20160825152647.ts6oq4sanxlbuneh@acer> <20160901153621.GA24685@kroah.com> <1472753981.4176.122.camel@perches.com> <20160901183310.GA7470@kroah.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2016-09-01 at 20:33 +0200, Greg Kroah-Hartman wrote: > On Thu, Sep 01, 2016 at 11:19:41AM -0700, Joe Perches wrote: > > On Thu, 2016-09-01 at 17:36 +0200, Greg Kroah-Hartman wrote: > > > On Thu, Aug 25, 2016 at 06:26:48PM +0300, Andrey Utkin wrote: > > > > On Thu, Aug 25, 2016 at 11:10:25AM -0400, Anson Jacob wrote: > > > > > Fix checkpatch.pl 'line over 80 characters' warning [] > > > > > diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c [] > > > > > @@ -92,8 +92,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) > > > > >   int array_size = ARRAY_SIZE(lowmem_adj); > > > > >   int other_free = global_page_state(NR_FREE_PAGES) - totalreserve_pages; > > > > >   int other_file = global_node_page_state(NR_FILE_PAGES) - > > > > > - global_node_page_state(NR_SHMEM) - > > > > > - total_swapcache_pages(); > > > > > + global_node_page_state(NR_SHMEM) - > > > > > + total_swapcache_pages(); > > > > >   > > > > >   if (lowmem_adj_size < array_size) > > > > >   array_size = lowmem_adj_size; > > > > Indeed original alignment on opening brace here doesn't make sense. > > > > I don't mind if your patch gets accepted, but out of curiosity I have opened > > > > this file in vim with kernel coding style plugin loaded > > > > (https://github.com/vivien/vim-linux-coding-style), selected the affected > > > > lines, and reindented the selection by pressing 'gq'. It ended up with this, > > > > being both shorter and simpler: > > > > > > > > diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c [] > > > > @@ -92,8 +92,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) > > > >   int array_size = ARRAY_SIZE(lowmem_adj); > > > >   int other_free = global_page_state(NR_FREE_PAGES) - totalreserve_pages; > > > >   int other_file = global_node_page_state(NR_FILE_PAGES) - > > > > - global_node_page_state(NR_SHMEM) - > > > > - total_swapcache_pages(); > > > > + global_node_page_state(NR_SHMEM) - total_swapcache_pages(); > > > The original patch here is nicer to read, don't you think? > > Strictly, these should probably be unsigned long instead of int > > as that's the return type of global_[node_]page_state(). > > > > Maybe something like the below, but then maybe other_free/file > > should become unsigned long too. [] > > diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c [] > > @@ -90,10 +90,11 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) > >   int selected_tasksize = 0; > >   short selected_oom_score_adj; > >   int array_size = ARRAY_SIZE(lowmem_adj); > > - int other_free = global_page_state(NR_FREE_PAGES) - totalreserve_pages; > > - int other_file = global_node_page_state(NR_FILE_PAGES) - > > - global_node_page_state(NR_SHMEM) - > > - total_swapcache_pages(); > > + unsigned long nr_free = global_page_state(NR_FREE_PAGES); > > + unsigned long nr_file = global_node_page_state(NR_FILE_PAGES); > > + unsigned long nr_shmem = global_node_page_state(NR_SHMEM); > > + int other_free = nr_free - totalreserve_pages; > > + int other_file = nr_file - nr_shmem - total_swapcache_pages(); > >   > >   if (lowmem_adj_size < array_size) > >   array_size = lowmem_adj_size; > I like it, much easier to follow.  Care to resend it in a patch form I > can apply it in? I think the android folk should figure out what the right thing to do with the int/unsigned long calculation is first. Arve?  Riley?