Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2098709ybg; Thu, 24 Oct 2019 04:49:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwe60MoTfMTrgDAacknvz3BRPQ8EMIfbn07BJlCIB63dYQp6DdS9loTfhs+T51LcTw4dKKd X-Received: by 2002:aa7:d44d:: with SMTP id q13mr43486663edr.48.1571917796392; Thu, 24 Oct 2019 04:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571917796; cv=none; d=google.com; s=arc-20160816; b=Mn5jnb07GMuT5x91GQT0+SfT/akkOSD/KzU/1QPQBj5AiTMopn1XdZ8we30Hz1P4Ry xiUHrd8uvZqel8/I9wFx1XzomKa3qfeV9vBVdVCUcXshTcoRdu18Wxu9hYdoIWbofdOa yGES62JUxwNEEEP04m+ZZbCebMp2y9GyNQZyBolZBHgSmSo2Z/mHLQ+lnZnV1wzQh7QS Y6rzlUGbw24sn/57BBSvKZAIh7ZbBxo5gAmVvha0dkwmBgqc6V54sAlqjfifCYoDWr5N M1CT6tw6+yFFUnDwqmwMifSphHR0Im7x1aiVX+6p+Mxz7857qrdYTbOA30MEdc8aRduv SrXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=pYPluV593635tS2En896gI8nsdrbZHAmMeMjWWNFoNQ=; b=zZRsYb7aJwNnAgDG2Bo6JXhjhxxkXNJL+BKwNfE69dRWX5CDk+3k/gymoPtAf9i7Hh m9JFS7SYrpGvRFvSCEEmJMiMjbbbkxljPcsyVZTTZFsa7vdbZrrCbHKrBsrbvedUgZWS 3uvnCwkdvRVQAJwj8FO24LZN9l57dgCKTbFCT7wmRKu0kDRZCsREBAfxN1fOnHIUBj5M rx+PCjF/sf4CpU25Vs7kJO8SOc2vaueugkS+1P1ZZ4VIpbnV/B5qxKEbpud2tFi1tGlF 6LkPiGitOja7N/51Wbzlm6lvVsn41JaDvy+FJsC33DFnyaav+TFw3zE1DP5JHp9/H9LR TfdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bqHj+xvP; 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 g23si13890540ejm.398.2019.10.24.04.49.31; Thu, 24 Oct 2019 04:49:56 -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=bqHj+xvP; 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 S1730867AbfJWRfc (ORCPT + 99 others); Wed, 23 Oct 2019 13:35:32 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:27963 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730701AbfJWRfb (ORCPT ); Wed, 23 Oct 2019 13:35:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571852130; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pYPluV593635tS2En896gI8nsdrbZHAmMeMjWWNFoNQ=; b=bqHj+xvPlJ3pHHEVJTKupVCycdfvW4gSoedVTdQDpkhgN2vHhQhTEpYNWDgUvfsOp+QWEX +LRE7yuMThSaxmo9c8M1tvS9eW3QKus1z73bxqxUKQd/8lmiy4Iau0v5GSP9RVEI5xCHWA awHGrR2CCqZW1YLN5IjVgtig4BI0HtQ= 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-236-86yMyZUaPui-i3hDilpdVA-1; Wed, 23 Oct 2019 13:35:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 645CA107AD34; Wed, 23 Oct 2019 17:35:24 +0000 (UTC) Received: from llong.com (dhcp-17-59.bos.redhat.com [10.18.17.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8CABF5D6D0; Wed, 23 Oct 2019 17:35:22 +0000 (UTC) From: Waiman Long To: Andrew Morton , Michal Hocko , Mel Gorman Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Johannes Weiner , Roman Gushchin , Vlastimil Babka , Konstantin Khlebnikov , Jann Horn , Song Liu , Greg Kroah-Hartman , Rafael Aquini , Waiman Long Subject: [PATCH 2/2] mm, vmstat: List total free blocks for each order in /proc/pagetypeinfo Date: Wed, 23 Oct 2019 13:34:23 -0400 Message-Id: <20191023173423.12532-2-longman@redhat.com> In-Reply-To: <20191023102737.32274-3-mhocko@kernel.org> References: <20191023102737.32274-3-mhocko@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: 86yMyZUaPui-i3hDilpdVA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that the free block count for each migration types in /proc/pagetypeinfo may not show the exact count if it excceeds 100,000. Users may not know how much more the counts will be. As the free_area structure has already tracked the total free block count in nr_free, we may as well print it out with no additional cost. That will give users a rough idea of where the upper bounds will be. If there is no overflow, the presence of the total counts will also enable us to check if the nr_free counts match the total number of entries in the free lists. Signed-off-by: Waiman Long --- mm/vmstat.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mm/vmstat.c b/mm/vmstat.c index c5b82fdf54af..172946d8f358 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1373,6 +1373,7 @@ static void pagetypeinfo_showfree_print(struct seq_fi= le *m, =09=09=09=09=09pg_data_t *pgdat, struct zone *zone) { =09int order, mtype; +=09struct free_area *area; =09unsigned long iteration_count =3D 0; =20 =09for (mtype =3D 0; mtype < MIGRATE_TYPES; mtype++) { @@ -1382,7 +1383,6 @@ static void pagetypeinfo_showfree_print(struct seq_fi= le *m, =09=09=09=09=09migratetype_names[mtype]); =09=09for (order =3D 0; order < MAX_ORDER; ++order) { =09=09=09unsigned long freecount =3D 0; -=09=09=09struct free_area *area; =09=09=09struct list_head *curr; =09=09=09bool overflow =3D false; =20 @@ -1419,6 +1419,17 @@ static void pagetypeinfo_showfree_print(struct seq_f= ile *m, =09=09} =09=09seq_putc(m, '\n'); =09} + +=09/* +=09 * List total free blocks per order +=09 */ +=09seq_printf(m, "Node %4d, zone %8s, total ", +=09=09 pgdat->node_id, zone->name); +=09for (order =3D 0; order < MAX_ORDER; ++order) { +=09=09area =3D &(zone->free_area[order]); +=09=09seq_printf(m, "%6lu ", area->nr_free); +=09} +=09seq_putc(m, '\n'); } =20 /* Print out the free pages at each order for each migatetype */ --=20 2.18.1