From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752591AbcAZVaa (ORCPT ); Tue, 26 Jan 2016 16:30:30 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:53929 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751532AbcAZVaZ (ORCPT ); Tue, 26 Jan 2016 16:30:25 -0500 Date: Tue, 26 Jan 2016 13:30:24 -0800 From: Andrew Morton To: Johannes Weiner Cc: Vladimir Davydov , Michal Hocko , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH] mm: memcontrol: drop superfluous entry in the per-memcg stats array Message-Id: <20160126133024.07f372dbf8935e03a3035269@linux-foundation.org> In-Reply-To: <1453841729-29072-1-git-send-email-hannes@cmpxchg.org> References: <1453841729-29072-1-git-send-email-hannes@cmpxchg.org> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 26 Jan 2016 15:55:29 -0500 Johannes Weiner wrote: > MEM_CGROUP_STAT_NSTATS is just a delimiter for cgroup1 statistics, not > an actual array entry. Reuse it for the first cgroup2 stat entry, like > in the event array. > > ... > > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -51,7 +51,7 @@ enum mem_cgroup_stat_index { > MEM_CGROUP_STAT_SWAP, /* # of pages, swapped out */ > MEM_CGROUP_STAT_NSTATS, > /* default hierarchy stats */ > - MEMCG_SOCK, > + MEMCG_SOCK = MEM_CGROUP_STAT_NSTATS, > MEMCG_NR_STAT, > }; The code looks a bit odd. How come mem_cgroup_stat_names[] ends with "swap"? Should MEMCG_SOCK be in there at all? And the naming is a bit sad. "MEM_CGROUP_STAT_FILE_MAPPED" maps to "mapped_file", not "file_mapped".