From patchwork Thu Mar 14 00:54:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13592015 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4762DC54E66 for ; Thu, 14 Mar 2024 00:54:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 77E6980072; Wed, 13 Mar 2024 20:54:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 72CD280073; Wed, 13 Mar 2024 20:54:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CDE280072; Wed, 13 Mar 2024 20:54:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 4481D8D006B for ; Wed, 13 Mar 2024 20:54:43 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E10C5A157B for ; Thu, 14 Mar 2024 00:54:42 +0000 (UTC) X-FDA: 81893824404.28.6CBE502 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf16.hostedemail.com (Postfix) with ESMTP id 392BE180006 for ; Thu, 14 Mar 2024 00:54:40 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="dAi9n/RM"; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=none (imf16.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710377681; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=y16FDE8fAPRzoyd3hzzZJsRMIkVkBbl8vnhWWzqELbo=; b=UlH7jtCdBOTsmaVaXKmlpRqwsDe3Ag+egt45bXdwDgDxyjwaKvLgJ9PhRyTyiWTYHcNl9v MofceIfuedvgvrnirYXnJJQWbBBiU04Dk3ERBiTO2qudL2m1YM4n2pDnma/R5BrLg5w/Vs jg0DO2yrNdFus+EbSU08gWPsRMvFwjk= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="dAi9n/RM"; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=none (imf16.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710377681; a=rsa-sha256; cv=none; b=HqXw5uK4LQHQw1PUDC+He3Zpy4NS+Ks3yDbeu0ayEU1+2yVoZume9ZQ8Dvjjn1HWnqnV1y 8tlgcRGPQKcjwWgUb6zgMtaEzMJasENaCrzk+/WJvajLFbJn8nF/nDxcefsHsIVaE8Cp9e 2QuVE1Jv/wAc8DNPbKe8gRoskLhW26c= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=y16FDE8fAPRzoyd3hzzZJsRMIkVkBbl8vnhWWzqELbo=; b=dAi9n/RMn/ptj6OJSi9OgXjOyR tDZPFaq5sSp4732/6rUz9KaNge5wN9Zqu05E9be1vnRnUXw2oDL9DEskCzo1gQRWyhbhWbVN3tQGc plqtMNv8ADqUgRHsc8cMlmwt9icx7Y7UCXL7xpQeQ7mR4vl/5axUYOFB439UAgpMMzHQzHjb01kAO M/2Evz9y4hSCSyDqomxADHXr+OBK2Ehk4hDuVAY6oSrAiX99kLW8g6vvfJa90E99ME3ORcgvz+kBI KQnmLb3FDo0FpGpwFdGiSzwisjOQGoipYTTNFskzCn9X87prdTbIXzJs9XwU4XM6yZweuUzXBAMS4 rc8dcZRw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkZMj-0000000CQo7-13QE; Thu, 14 Mar 2024 00:54:37 +0000 From: Luis Chamberlain To: akpm@linux-foundation.org, jhubbard@nvidia.com, vbabka@suse.cz, mgorman@suse.de, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, dave@stgolabs.net, p.raghav@samsung.com, da.gomez@samsung.com, mcgrof@kernel.org Subject: [PATCH 3/3] mm/vmstat: simplfy extfrag_show_print with fragmentation_index() Date: Wed, 13 Mar 2024 17:54:35 -0700 Message-ID: <20240314005436.2962962-4-mcgrof@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240314005436.2962962-1-mcgrof@kernel.org> References: <20240314005436.2962962-1-mcgrof@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 837h48cr1cego66sfrjbmsy6ub5hd5pc X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 392BE180006 X-HE-Tag: 1710377680-521027 X-HE-Meta: U2FsdGVkX1/q1jJms5fa75tvaJvKkRBLUfmmisz/8RCf1S/0TtI+p6KgfBcoYrq0naIhJRLXnHteFbXYi7HCY+/fr1aRkjsPEwjq8YT0Ksj9Oaqoyx6vwJ5E6jQyDplIJChS9eQinosEj1FDyRffpLoqpnw7Dui0qOIURQFVtW31JD7Vb6CIotiCLV1A2fbtmvhKupiMGGAF3MKI+02cf2czU/B8XwQblWmP8vXev+UGkV/66FQaeQhUFQ5y7PitOBCBvf12bK049QO5eTolMtsjQ6FMY5jpdEmps8puDFauROvYXsGkI4InRYIGLOalFfiqQQv/jZuLq7KGgsnULHVvshhmYAd9aWOabIn0AobSZmiL1Q/5/NKLEd6rgF7YlBQsz7WHkGPehI/cFhY4xmaZzPCOeXrjPih9YTZmDDxIECuARlSD5RB98KzAXegTv3ubxPJ1eS93DYyt4xH+uE8nWTSuR6H7LjXOEAKR5hgsoJ3HFyN5mCq7y44JMo7Rf2pwkzBn0Ghg4tzUkcs4MXKu5tB6cTpg9ckJLRpqQ+CeJD/cJaXCL9u9wtVJrOgpeWUf1wkMHPjmqbcKG9zruK+sYuMPyChDsOWJF9qqdcPQGcp3/4WFKBQdZqCHb4MhZtm+XMrUojSt6wW44rJsSQ/optIpQuNLe9pCcz6SZOsUyNmX/q5djs57LvCQus43diB2l2X+qo3n5IwP4bjTdLnLWsi7RMFSJPxtpbhFYPwnqaDqJ3YmGDKgnewBWNUF1rypEUf+FGbDBZFfUGDvK4nJ3kT+ktKaDzJaHCLWdYQE5v5us71VtoBlMYSxhCRyqw7sgBjLjal7ZMW2YFFnoshrdHRQgumj65gK36EG3n8tNIyZo0v/yaKJ6KZBJsgdFymDegG3M2ZVWdLzK2hv+JRs1QDudNU//7Uv8B9BeVz9P2i41bkyezz/tMAJoCXt06Orq6GdtcAEcl6OWtk opur7hIu JNMBMYtazU6dj/O4922LXxn11Nga6KWRWrmgT7gZshkNQsafV+akuHsqk/GOGNaUwSW9hvJH6lK5lYUz3ZJ8XzIZpqJPQp3XwewQ7yhCeI9beh/1Zu0e64l1mfZVIWUC6cJH7UvFUNagdxxp6G1q24+PXFLlaH4HEec/V 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: List-Subscribe: List-Unsubscribe: fragmentation_index() already uses the stack for the struct contig_page_info, so just use that and enhance the documentation for fragmentation_index(). Signed-off-by: Luis Chamberlain Reviewed-by: Vlastimil Babka Reviewed-by: Davidlohr Bueso --- mm/vmstat.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mm/vmstat.c b/mm/vmstat.c index db79935e4a54..582f89b37ccf 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1129,7 +1129,10 @@ unsigned int extfrag_for_order(struct zone *zone, unsigned int order) info.free_pages); } -/* Same as __fragmentation index but allocs contig_page_info on stack */ +/* + * Same as __fragmentation index but allocs contig_page_info on stack, + * useful when walking a zone as interrupts are disabled. + */ int fragmentation_index(struct zone *zone, unsigned int order) { struct contig_page_info info; @@ -2227,15 +2230,11 @@ static void extfrag_show_print(struct seq_file *m, unsigned int order; int index; - /* Alloc on stack as interrupts are disabled for zone walk */ - struct contig_page_info info; - seq_printf(m, "Node %d, zone %8s ", pgdat->node_id, zone->name); for (order = 0; order < NR_PAGE_ORDERS; ++order) { - fill_contig_page_info(zone, order, &info); - index = __fragmentation_index(order, &info); + index = fragmentation_index(zone, order); seq_printf(m, "%2d.%03d ", index / 1000, index % 1000); }