Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp5183514ybb; Tue, 24 Mar 2020 12:27:20 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsWP7mbdffuElkqgcEiIp2jAysJrQLcsaM1vKcfNJ5jRYDxb8ANfHD2X5EZDOHggPdKFSJr X-Received: by 2002:a05:6830:1296:: with SMTP id z22mr8276104otp.108.1585078040660; Tue, 24 Mar 2020 12:27:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585078040; cv=none; d=google.com; s=arc-20160816; b=P2X3BWdMEHhMP4wisiqWqEMU0BFucw0KBzrogSx7Cv35xQ7jbxnkp/bO+ZrQLz+spO Ma6DWzImO9iF0xtdU5xRNj4mZAxWctq1zkNJn67ddHWJSqK5fuUEJMLqHQlhye7MOqw1 kNr/lvHwxNLxZiIdS/uoG+fgGxP1TROCkEQM6rV/pLEI16aysPmQj79iAX1dXSrML6Wd ndEi9PHh3mTR+4U9MMtH45+Y36zonL0S7jsocJNDfwhM3kqz2fPdSHwRteyypLLB/47r zt/PJZbXMDJPyeJ8O/545AAVb1XI6HFfrsCZaz65fcgC9h09mEVdnheTYOnURE1ZKgKK hZrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=b0vJ6NY31m5cGG2hLm9OUyIsW263Iau0X4y6ey2x+mI=; b=Ad3w6P+tMalPxZqVU8poCMTHM3n5fFHc+wVGP73ZY9SXOm47PHfNlnEivGHXg7oevF eSM6Y0APrmQcrHNKBpac4a9hyZUq1Fk4KqZWnu26BZxhg+QxLlr8HCiHtv8/fyWvCDmE 1jwvywlydZkP63waQm0IxdmC2gC5ojKsAcnflZmrGlpUYIaf+HP8bRdjxjagwoSWUDQK PNzr1UOv+/pif6d+yW4qfQSX6vP9fqVfFwtSPW4lWnMsrYan++/opoylLYcVjST9W4we RmQoue63Wr49/LGe+lshegV+ENn8jcEL1iRjQXjcLe2P4VX9pLfAORo8UWFrddX4BeuS 0Ezw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZsTTtppK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l20si10403895otn.37.2020.03.24.12.27.05; Tue, 24 Mar 2020 12:27:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZsTTtppK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725941AbgCXTZH (ORCPT + 99 others); Tue, 24 Mar 2020 15:25:07 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:33573 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725835AbgCXTZH (ORCPT ); Tue, 24 Mar 2020 15:25:07 -0400 Received: by mail-pg1-f194.google.com with SMTP id d17so8969810pgo.0 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=cMtxBwuDRpogis7H9CDO+Y9AAC1k3Gb9GumMupGz59/7Gu7+coxSX3p8Z+L13KJm+y FXsxdXodW11wmTaa4U9ZrbygXr3bgc92u1XI8W7fgzxGPTxXKZ3YXvexWjEnnhw6XC1Z m56KPgc+i7lM0eGeWVhwTrIbL5okqCxoJ4n7mUG7lpyyZaRYWvsBvyKyHmqf2EeZ3qs1 ThDyeUxfaBliF4pU5xZa/HlBsEhYCZ896cn6AKo4TGyKXgPxVBq6fL62SO/j4u7EJXvm g1C+ofETqtvD7CcZRExkzwTdo+mShA4IjA6gDRwAQP9+Dm32+coiBNaOV80pWHCNQU41 WH3A== X-Gm-Message-State: ANhLgQ1C/amFaaJchR4PggOD3vZ+0UbO6gZVBUqrXva8DFU46XCxmRiz MC7AfZwgBfSF4roih6TLdlyE3A== 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > >