From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A739C433E0 for ; Thu, 4 Feb 2021 20:06:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B71B464DF8 for ; Thu, 4 Feb 2021 20:06:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B71B464DF8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 204076B0005; Thu, 4 Feb 2021 15:06:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 18EB86B0006; Thu, 4 Feb 2021 15:06:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 07D926B006E; Thu, 4 Feb 2021 15:06:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0058.hostedemail.com [216.40.44.58]) by kanga.kvack.org (Postfix) with ESMTP id E68BE6B0005 for ; Thu, 4 Feb 2021 15:06:24 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A5B33362E for ; Thu, 4 Feb 2021 20:06:24 +0000 (UTC) X-FDA: 77781667488.01.ghost91_1614f2a275de Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id 0C4951004AFA8 for ; Thu, 4 Feb 2021 20:05:57 +0000 (UTC) X-HE-Tag: ghost91_1614f2a275de X-Filterd-Recvd-Size: 4783 Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Thu, 4 Feb 2021 20:05:56 +0000 (UTC) Received: by mail-qt1-f177.google.com with SMTP id t17so3377051qtq.2 for ; Thu, 04 Feb 2021 12:05:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=PNpabScqAJL/H2mjmh5glVW/nkx6cWA4Jun5NHUQOrM=; b=rpVczFjAy+Eo1fHw1BDYqgKj2CQrvpHaS52itpgYB9u+R9fd0OhJLGQIGcLuIThgmO 1EtEXj/HZXv0cMrN3wwlbjmxFv0no8HWWMeBsQOOozyuyAktfcg83i2gOzL6ta27x3jZ fcYwOlWIODDKif1RHsWfYyVzyy7fGIJFXDzn99yB7VC74nQEq23Y/RURT9mndO8E2/ea lgGcPE4IFkvVV1lL135khk1YP8UB8EI2+F7IoJqlBqN4rYvkp8AZoq05eM+aOdE9R0tT IcJk3AlHMA4eXi43FufTKxW8GKY3BaUaqYy7gBV8GBlAwhvBG0lGamR6wHXHPGv6HXg6 vkjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=PNpabScqAJL/H2mjmh5glVW/nkx6cWA4Jun5NHUQOrM=; b=CFb4UhbD1XCZeuQOZ9hbUCCI3zsDroZ3xTwz0keMthLsC636yva49MIVJGgXtZHPHT V4iivhLoSbs1LSSmN/YFk+TPzk3CzkddQ/K+UPzlPQg5xDWG/2ij6Qu0Vy6x6y/5TmAI PYRpUCMmQ6o8+LtJ8ywAIKngUbw4AClZB0m593uhBso7RcDfIz3yiGHJFm1fU+Vatoy9 Z+cmvGnKLblQJa7jtbKwT3jC6GiAUmfbtGL1F8RIYbqKbREfMCCVGLjfDFH56BR+FMJa VCAPjL6C+D3jb8tv5EMXBdpodCaTl2M19oQ0w9Zb/US7BiijmwiQv2GJ3I+CudhUKapw g7dA== X-Gm-Message-State: AOAM532Wyq6xjJLJTYRFMU9VQdLuC4tXiEo19G5WDSORmno+9KDZAeGd d9tdzy03I2H5ePar5mPWQhNi9w== X-Google-Smtp-Source: ABdhPJyZZA46ofyz59zphWQtKYjnhI0FsTngAQYc0CmeWI9YcxVNaC1vxMTQKCToJYvsy/ymtjimsg== X-Received: by 2002:ac8:16f2:: with SMTP id y47mr1296485qtk.96.1612469155734; Thu, 04 Feb 2021 12:05:55 -0800 (PST) Received: from localhost (70.44.39.90.res-cmts.bus.ptd.net. [70.44.39.90]) by smtp.gmail.com with ESMTPSA id f8sm5332143qth.6.2021.02.04.12.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 12:05:54 -0800 (PST) Date: Thu, 4 Feb 2021 15:05:53 -0500 From: Johannes Weiner To: Roman Gushchin Cc: Andrew Morton , Tejun Heo , Michal Hocko , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 6/7] mm: memcontrol: switch to rstat Message-ID: References: <20210202184746.119084-1-hannes@cmpxchg.org> <20210202184746.119084-7-hannes@cmpxchg.org> <20210203014726.GE1812008@carbon.dhcp.thefacebook.com> <20210204184520.GC1837780@carbon.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210204184520.GC1837780@carbon.DHCP.thefacebook.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Feb 04, 2021 at 10:45:20AM -0800, Roman Gushchin wrote: > On Thu, Feb 04, 2021 at 11:26:32AM -0500, Johannes Weiner wrote: > > On Tue, Feb 02, 2021 at 05:47:26PM -0800, Roman Gushchin wrote: > > > On Tue, Feb 02, 2021 at 01:47:45PM -0500, Johannes Weiner wrote: > > > > for_each_node(node) { > > > > struct mem_cgroup_per_node *pn = memcg->nodeinfo[node]; > > > > + unsigned long stat[NR_VM_NODE_STAT_ITEMS] = {0, }; > > > ^^ > > > I'd drop the comma here. It seems that "{0}" version is way more popular > > > over the mm code and in the kernel in general. > > > > Is there a downside to the comma? I'm finding more { 0, } than { 0 } > > in mm code, and at least kernel-wide it seems both are acceptable > > (although { 0 } is more popular overall). > > { 0 } is more obvious and saves a character. The comma signals that the author is aware that the array or structure has more elements than specified, and that they expect the rest to be zeroed. We use it extensively to initialize structures (like struct cgroup_subsys inits, cftypes, struct address_space_operations, etc.) So I'd say "more obvious" is subjective. I find the comma version a bit more obvious. > The "problem" with comma version is that { 1, } and { 0, } have a > different meaning. ...which is? They both mean set the first element to x and zerofill the rest, no? Again, I don't really care too much either way, I'm just wondering if I'm missing something bigger here.