Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4902006ybb; Tue, 24 Mar 2020 07:25:08 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsSegiYVjHWPXJcKHCq1R9FCEhxJcnPcPb7fYhQXFz7y/RKpmVDzLSAIygGsz4ex0DBUyem X-Received: by 2002:a05:6808:43:: with SMTP id v3mr3652022oic.59.1585059908043; Tue, 24 Mar 2020 07:25:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585059908; cv=none; d=google.com; s=arc-20160816; b=RkRI/7RKJ5fqFDNIuW9+P7kZ6UYaBZy/+TSsUnvkYjbNLXW1PN4XEjxzr+/i6/rkWC ZD7UrIHq7B1pGzLCUVBfyRUCcM6BtPlDYiDD9QMGkNQdknd1t7MagnLpxY5Vlz5Oi8Al eGmtn76qhDhvYf9BoK4lZK4vA2Rt1ePleGzMG9YfQsFdpfnxAKetw9tjE61Sixzu/tfb PklfskfPlIAgCjwsbkaCnmaumsbK6Nmx996ALw5FZ6+SXdClkbFsPzdYDHmpaET/RYz3 H1TWr+PqY54B9KAQo76p4n7d5O693/1iXHipIXkf16p/EWgOTmISBKogHwx3I49X4Tkp Avow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=+TmMAyQNdrsWtGKQJAPznO269BAHbZfbwCisH4kJOrg=; b=0sfxuwcZlSRhXsd9JHu/rCBUQu2Wjgg8dZir3P7bKM0WSolZmJYDIsqr420Sb9rvan RWryoKJnQZ9oT2rd0XA7cE4bXhtVWNTqqb9M7zXMX1f0KxsqjAz11cx2xehKbTp3Y00B 45+oTYrFi4QMeaV4exSfdVWqLfrj1UrbMh47dbDKK2McBbwvgvYfpYdksqlAzPnPOqxM Bf4hAxxhkAWWDEuXOB9LIHVWoKa9adGmREcVYyNPl2d9G7rOzBZY/OyhNMeM6sfIsTVJ U7VYR2WIQl739td47DKAXIzqhHF2mH50A82NegG3nSEub1rqPoavdzBQGtBoKvNM66q6 /CIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NSZJf3Cw; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j18si5105307otk.166.2020.03.24.07.24.50; Tue, 24 Mar 2020 07:25:08 -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=@redhat.com header.s=mimecast20190719 header.b=NSZJf3Cw; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728144AbgCXOW7 (ORCPT + 99 others); Tue, 24 Mar 2020 10:22:59 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:29532 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727270AbgCXOW6 (ORCPT ); Tue, 24 Mar 2020 10:22:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585059777; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=+TmMAyQNdrsWtGKQJAPznO269BAHbZfbwCisH4kJOrg=; b=NSZJf3CwGxIxIoZShzyIuicCkBiq6jCStpsIqpUQMD3ouqtyTHCD9FiN8v9Xd9ZgFZM2eM ts//bW3UeVJLGTkpwk8thqV2OYrVF5IUUhr+bOaJ9u0LztrIpSUF4871jm9Kz0P9BdTO9B FqE8BDc2Ls15a/uQq2S0R/j1LolgoJY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-384-ii-GG5eyOzmxWs7MUxp1FA-1; Tue, 24 Mar 2020 10:22:53 -0400 X-MC-Unique: ii-GG5eyOzmxWs7MUxp1FA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 28FE1800D5E; Tue, 24 Mar 2020 14:22:52 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-69.pek2.redhat.com [10.72.12.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id B53C05C557; Tue, 24 Mar 2020 14:22:48 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, iamjoonsoo.kim@lge.com, hannes@cmpxchg.org, mhocko@kernel.org, vbabka@suse.cz, bhe@redhat.com Subject: [PATCH 4/5] mm/vmstat.c: move the per-node stats to the front of /proc/zoneinfo Date: Tue, 24 Mar 2020 22:22:28 +0800 Message-Id: <20200324142229.12028-5-bhe@redhat.com> In-Reply-To: <20200324142229.12028-1-bhe@redhat.com> References: <20200324142229.12028-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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