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=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 3993FCA9EB7 for ; Wed, 23 Oct 2019 17:35:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 02EFB21906 for ; Wed, 23 Oct 2019 17:35:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bqHj+xvP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02EFB21906 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A9BF96B0007; Wed, 23 Oct 2019 13:35:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A4E066B0008; Wed, 23 Oct 2019 13:35:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C6366B000A; Wed, 23 Oct 2019 13:35:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0196.hostedemail.com [216.40.44.196]) by kanga.kvack.org (Postfix) with ESMTP id 6F3DB6B0007 for ; Wed, 23 Oct 2019 13:35:31 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 21DC18419 for ; Wed, 23 Oct 2019 17:35:31 +0000 (UTC) X-FDA: 76075751262.24.verse36_1307540a5a508 X-HE-Tag: verse36_1307540a5a508 X-Filterd-Recvd-Size: 4565 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Wed, 23 Oct 2019 17:35:30 +0000 (UTC) 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 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: 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