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=-15.9 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1, USER_IN_DEF_DKIM_WL autolearn=ham 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 BBF4FC43331 for ; Tue, 24 Mar 2020 19:25:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 639962074D for ; Tue, 24 Mar 2020 19:25:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZsTTtppK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 639962074D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EA8DA6B0003; Tue, 24 Mar 2020 15:25:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E7FD06B0006; Tue, 24 Mar 2020 15:25:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D95566B0007; Tue, 24 Mar 2020 15:25:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0066.hostedemail.com [216.40.44.66]) by kanga.kvack.org (Postfix) with ESMTP id C12B26B0003 for ; Tue, 24 Mar 2020 15:25:07 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5F97A813322A for ; Tue, 24 Mar 2020 19:25:07 +0000 (UTC) X-FDA: 76631233854.06.brass39_840015d21240c X-HE-Tag: brass39_840015d21240c X-Filterd-Recvd-Size: 6416 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Mar 2020 19:25:06 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id i13so9834348pfe.3 for ; Tue, 24 Mar 2020 12:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=b0vJ6NY31m5cGG2hLm9OUyIsW263Iau0X4y6ey2x+mI=; b=ZsTTtppK4VSkmrFT7n7mwQA8kbS22nbNIU50ruT2Q/4jux1kNjWkvJe0Nb7eTyxevz iWRMJU7fIWqj3lnJHkptL2l25M996rVZdvzC8PFQlP+LdZuozBkCBEsWELqHa+MXgxn+ JBuIJnCgwxBNtt5vtpTe2V0YrbvXndGXbhpCFNFDmg16jLlFCeBK6nhXtmKk9e6jel4R bPVvz3huX9tvTnBKIkOwLpuxuEL/5zi3QTmBX2SKQcxS0osNy/ht/9hfmTkxiXG9bv/p J0w721bXRYC/wNe3cJbXbidrJo728mLLVzNz5dS90+VQM9yiW52Dd/AIXeg/9jZoKpHY YNbQ== 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:in-reply-to:message-id :references:user-agent:mime-version; bh=b0vJ6NY31m5cGG2hLm9OUyIsW263Iau0X4y6ey2x+mI=; b=JSV2dZDWCcstMiavAI/cfIX1vJ3XQ0fwgEkPq2M1nn89MwAChu5VreYg4SEVlAqXsT 4pbPIoMsdDft15LrnbbddYoUD9nzuhzE/Levn2jP/jgRdC9ttXTVxtFmjeEFrGqoCUi3 ucaNx74A7O0r+bJoMg1nQ4YTRTYTK5fUCHB6aw25/ija4aKxeDnb4uAl2M0DEOO9n8JX yyznBb5k1tPbgGY0dFN6yfxYk/2LPGi4gw3Fw7o4dRxNL/UuCakOeIo+8WJENyyOODpL +hYGk1e8H/16CtU1pE+RGEEfBvgL8+5hGwgOUk/PSyhRmc8AZ5WnjkcTGBWNuCP2W4lM 2b0g== X-Gm-Message-State: ANhLgQ1xrbW9JkBHZLXaNmFvTuNzB3n5Xa8I+0GEZd/rcjQZlT4aawIH RYWvGEgmw5SkVrFUuX0Bjx7O8A== X-Google-Smtp-Source: ADFU+vu1prW9SuVKgUjYf5SYCcIL6Q7+0zUgILCyyFh8Ci/mMupwTkj2SpbTzeJm/oaz/c31iGhkYA== X-Received: by 2002:a62:868a:: with SMTP id x132mr29193347pfd.208.1585077905694; Tue, 24 Mar 2020 12:25:05 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id j21sm8247708pff.39.2020.03.24.12.25.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2020 12:25:04 -0700 (PDT) Date: Tue, 24 Mar 2020 12:25:03 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Baoquan He cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, iamjoonsoo.kim@lge.com, hannes@cmpxchg.org, mhocko@kernel.org, vbabka@suse.cz Subject: Re: [PATCH 4/5] mm/vmstat.c: move the per-node stats to the front of /proc/zoneinfo In-Reply-To: <20200324142229.12028-5-bhe@redhat.com> Message-ID: References: <20200324142229.12028-1-bhe@redhat.com> <20200324142229.12028-5-bhe@redhat.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 Tue, 24 Mar 2020, Baoquan He wrote: > This moving makes the layout of /proc/zoneinfo more sensible. And there > are 4 zones at most currently, it doesn't need to scroll down much to get > to the 1st populated zone, even though the 1st populated zone is MOVABLE > zone. > Doesn't this introduce risk that it will break existing parsers of /proc/zoneinfo in subtle ways? In some cases /proc/zoneinfo is a tricky file to correctly parse because you have to rely on the existing order in which it is printed to determine which zone is being described. We need to print zones even with unmanaged pages, for instance, otherwise userspace may be unaware of which zones are supported and what order they are in. That's important to be able to construct the proper string to use when writing vm.lowmem_reserve_ratio. I'd prefer not changing the order of /proc/zoneinfo if it can be avoided just because the risk outweighs the reward that we may break some initscript parsers. > Node 2, per-node stats > nr_inactive_anon 48 > nr_active_anon 15454 > ... > nr_foll_pin_acquired 0 > nr_foll_pin_released 0 > Node 2, zone DMA > pages free 0 > min 0 > low 0 > high 0 > spanned 0 > present 0 > managed 0 > Node 2, zone DMA32 > pages free 0 > min 0 > low 0 > high 0 > spanned 0 > present 0 > managed 0 > Node 2, zone Normal > pages free 0 > min 0 > low 0 > high 0 > spanned 0 > present 0 > managed 0 > Node 2, zone Movable > pages free 196346 > min 3540 > ... > managed 262144 > > Signed-off-by: Baoquan He > --- > mm/vmstat.c | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > > diff --git a/mm/vmstat.c b/mm/vmstat.c > index 6fd1407f4632..4bbf9be786da 100644 > --- a/mm/vmstat.c > +++ b/mm/vmstat.c > @@ -1567,13 +1567,6 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, > { > int i; > seq_printf(m, "Node %d, zone %8s", pgdat->node_id, zone->name); > - if (is_zone_first_populated(pgdat, zone)) { > - seq_printf(m, "\n per-node stats"); > - for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) { > - seq_printf(m, "\n %-12s %lu", node_stat_name(i), > - node_page_state(pgdat, i)); > - } > - } > seq_printf(m, > "\n pages free %lu" > "\n min %lu" > @@ -1648,7 +1641,18 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat, > */ > static int zoneinfo_show(struct seq_file *m, void *arg) > { > + int i; > pg_data_t *pgdat = (pg_data_t *)arg; > + > + if (node_state(pgdat->node_id, N_MEMORY)) { > + seq_printf(m, "Node %d, per-node stats", pgdat->node_id); > + for (i = 0; i < NR_VM_NODE_STAT_ITEMS; i++) { > + seq_printf(m, "\n %-12s %lu", node_stat_name(i), > + node_page_state(pgdat, i)); > + } > + seq_putc(m, '\n'); > + } > + > walk_zones_in_node(m, pgdat, false, false, zoneinfo_show_print); > return 0; > } > -- > 2.17.2 > > >