From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757446AbbGGOs6 (ORCPT ); Tue, 7 Jul 2015 10:48:58 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:35456 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752349AbbGGOsx (ORCPT ); Tue, 7 Jul 2015 10:48:53 -0400 Date: Tue, 7 Jul 2015 23:48:45 +0900 From: Minchan Kim To: Sergey Senozhatsky Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH v6 5/7] zsmalloc/zram: introduce zs_pool_stats api Message-ID: <20150707144845.GB23003@blaptop> References: <1436270221-17844-1-git-send-email-sergey.senozhatsky@gmail.com> <1436270221-17844-6-git-send-email-sergey.senozhatsky@gmail.com> <20150707133638.GB3898@blaptop> <20150707143256.GB1450@swordfish> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150707143256.GB1450@swordfish> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 07, 2015 at 11:32:56PM +0900, Sergey Senozhatsky wrote: > On (07/07/15 22:36), Minchan Kim wrote: > [..] > > > struct zram *zram = dev_to_zram(dev); > > > + struct zs_pool_stats pool_stats = {0}; > > > > Does it work even if first member of the structure is non-scalar? > > Personally I prefer memset for initliazation. > > I believe modern compiler would optimize that quite well. > > zs_pool_stats contains only one member now, so I didn't bother. > > [..] > > > struct zs_pool { > > > - char *name; > > > + char *name; > > > > huge tab? > > > > > > > > - struct size_class **size_class; > > > - struct kmem_cache *handle_cachep; > > > + struct size_class **size_class; > > > + struct kmem_cache *handle_cachep; > > > > tab? > > tab? > > > > > > > > - gfp_t flags; /* allocation flags used when growing pool */ > > > - atomic_long_t pages_allocated; > > > > Why changes comment position? > > Because otherwise it breaks 80-cols rule. > > > > + /* Allocation flags used when growing pool */ > > > + gfp_t flags; > > > + atomic_long_t pages_allocated; > > > > > > > Why blank line? > > To make it more readable? Separating logically different > struct members. That's why the original code contains blank > lines between `char *name' and `struct size_class **size_class; > struct kmem_cache *handle_cachep;` and so on. > > I see no issue. > Okay, I am not against aboves you mentioned. But please don't squeeze cleanup patch into core patchset from next time. It really hate to review and make confused git-blame. > > > > + struct zs_pool_stats stats; > > > #ifdef CONFIG_ZSMALLOC_STAT > > > - struct dentry *stat_dentry; > > > + struct dentry *stat_dentry; > > > > Tab. > > Well, I see no issue with aligned struct members. Looks less > hairy and less messy than the original one. But this is that I'm strongly against with you. It depends on the person coding style. I have been used white space. As well, when I look at current code under mm which I'm getting used, almost everything use just white space. > > clean: > > struct zs_pool { > char *name; > > struct size_class **size_class; > struct kmem_cache *handle_cachep; > > /* Allocation flags used when growing pool */ > gfp_t flags; > atomic_long_t pages_allocated; > > struct zs_pool_stats stats; > > /* Compact classes */ > struct shrinker shrinker; > bool shrinker_enabled; > #ifdef CONFIG_ZSMALLOC_STAT > struct dentry *stat_dentry; > #endif > }; > > > > dirty: Never dirty. It's more readable. > > struct zs_pool { > char *name; > > struct size_class **size_class; > struct kmem_cache *handle_cachep; > > gfp_t flags; /* allocation flags used when growing pool */ > atomic_long_t pages_allocated; > > #ifdef CONFIG_ZSMALLOC_STAT > struct dentry *stat_dentry; > #endif > }; > > -ss -- Kind regards, Minchan Kim