From patchwork Thu Mar 14 00:54:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13592017 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 F101CC54E66 for ; Thu, 14 Mar 2024 00:54:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 04ECF80071; Wed, 13 Mar 2024 20:54:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF0318D006D; 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 77BD180071; Wed, 13 Mar 2024 20:54:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4B2DC80071 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 102F9A157E for ; Thu, 14 Mar 2024 00:54:43 +0000 (UTC) X-FDA: 81893824446.28.296E1EB Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf02.hostedemail.com (Postfix) with ESMTP id 569FF8000A for ; Thu, 14 Mar 2024 00:54:41 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=r0hduQlU; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=none (imf02.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=7afOyl7nv+Mi2FyolEBEsVPtXVCWDMinpJ3b7YCSncQ=; b=w+CyJm0REfK0ZMWW9iJRSv/rkSX/wvdYTPKivBDgV9Q7wtRuFkRqDtAtSh3T7Mrxaq8m2y 7wIz4GpuajtDJnYYRqKNy7RBHBL9CQyyyav5x3Cn2jYDZAp3MrAJLB+wHlbYyAJW4Owr3/ H6FRuzYZNcW1Ms89valXLfovKL715gM= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=r0hduQlU; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=none (imf02.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=or9txwHFTvTLCFC8x9GR4WBTY4dmgFhCXgS12+gMmKfX+K13c5e6cXeTFecBgfilA+tSTm WHll+mIJt6qoIpMPCrG5icgjx9IoOhxkw/sLd2n2oIZCkZIoPjDj8GEJFgJ5K6Y1G+IYHt 7wWa2VzaxD+m+3W1ZGkHkMddk9lLzjs= 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=7afOyl7nv+Mi2FyolEBEsVPtXVCWDMinpJ3b7YCSncQ=; b=r0hduQlUY10mSUkoM9CAoK9lkY yTEkaLMR27xDBoYJKGbslC7WZIvQXb4tlMjx+hEm/VkTWjjgeaw6Dh4AS48tbKqqNwv/oVRFt/2ta 8dWEbIaV4Z4BQuqcN1A+OoK/m5xwTbjJ5iqq9SObSEGbyZo4zlqplKXYlWI1k6bUDwY273nsRqykB 7RehX2u5lZDO1JbzAel4LeqG3LjmL07vw/Wv0/tZJt/8kzLfBjKJ/LMnqg01l8UKJ6T+0I9TshIxN A/66N/n4PAoQQw/KTp/hDAZ79HtS9FuEf/NDkv/loDe+kcCcTMjQU8I492IF9burTzY94jLRQMWPH XhLuJErQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkZMj-0000000CQo2-0f9b; 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 1/3] mm/show_mem: simplify ifdef on si_meminfo_node() Date: Wed, 13 Mar 2024 17:54:33 -0700 Message-ID: <20240314005436.2962962-2-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-Rspamd-Queue-Id: 569FF8000A X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 3pzdgqui66jwmesfncdc4utokkeqskd1 X-HE-Tag: 1710377681-193791 X-HE-Meta: U2FsdGVkX1/sLvvNVCmHltnmYMt/ZFcQ3e7+0gdu/YRRtToX3i6S325K6SDP8r6ABZIrBeWHkfOFGbjFGMm6w1ZVdYxQf3vSn4FIV/dwRWvFEQ01aymW3X+EDwcRjLRcHZ95dInTTTYN1MGYl75nRJlr0IFwdwSbTVk8lgcq6j7UwRNrrrxQKQI3V1vjp0B8g7AlsNv30joE/Gn1lTDELPnYqmbt7aL16lg/NXu1w9Xrb04he2DwtyHztOWvAEwsMR4bAvgZpNzdVIHfTnO02IaN1r7l/VIzoDVR2ehOdBDFBykWd//DsGK3F52SvnishicnKcq3UhWPJ1RyoX0WLCPR2y0bYvsokZZ1GqrzEXqiNIcUIpZ8SACepSQwHxEmOdNqoxEWNiP8xFlxwA23o28MuzbyjpiMPoJYkh/MnoLjDPgj0rL17yh3abk0yG+jdQYgPQlLao873uvG27vHe/hOOW6NuDz8r4np4r70QXzUQSxVkVn/yFarSnZbN4lhLIpUdhvLttHYhnJ6LZZz5+2m18Cz0zeXjrDJqtcfeL0NTq8IPX7CCyrmYhxf/88ZPwO/lC5IBkj0yDxbybwaxT+a71R5wthUFeNKVBkNF6CXpmPdCAZPV220Yi8RCU7cXW0BDhtOaABr1VwL36pP5GO/1e7mOjZDK6MF3SwNWUQEaQcu2i9UbkzpyRXW+Gx+ERqjnyXGNqbcGjW5civBqxMeW6xDecM+tD9SglLmIs6vXIKIRgyn3YYrIXUPKoSeGSIAKUsnmUoJ3o7iemfwCuqHfwxaiVN9uHT6NibwCzJzGKLBe9ih1aS1dWXKOF7Y0lF1OVijM/l9bvi0Bwy82vfkK5WY0mQlcanRZZM10Sm1rKK7VuhFpaQsnq3riNVZ0HBkaropm65l5h2u0oAXvkkcDGFfdqwAZLsrwf9Uyk3WcytAcahINuQUZ/O6J+G4obWZg77YXJZmTYL5iiU fZo5Kt1C Dblzjbp/4jrkh+mKeRVzudprBLF6IflJoz3G+lfu3Df0Whr5sEoeRUnAZh4/QgreSiUNkKgtaPWjofPiIcmoQznEvYkm7RStZzFskBaiQ3/rw6HvIyl2IIf9zKCt1u5biyWYj0f5evkCj2J9+IEksKj+Yn1r8AJKIS1xS X-Bogosity: Ham, tests=bogofilter, spamicity=0.000013, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: There is an ifdef where the same exact values are used at the end, so remove the else and keep the same values for both conditions. Signed-off-by: Luis Chamberlain --- mm/show_mem.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mm/show_mem.c b/mm/show_mem.c index 8dcfafbd283c..529d2f9b6410 100644 --- a/mm/show_mem.c +++ b/mm/show_mem.c @@ -108,12 +108,9 @@ void si_meminfo_node(struct sysinfo *val, int nid) free_highpages += zone_page_state(zone, NR_FREE_PAGES); } } +#endif val->totalhigh = managed_highpages; val->freehigh = free_highpages; -#else - val->totalhigh = managed_highpages; - val->freehigh = free_highpages; -#endif val->mem_unit = PAGE_SIZE; } #endif From patchwork Thu Mar 14 00:54:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13592018 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 021DAC54E67 for ; Thu, 14 Mar 2024 00:54:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2B63E8D006B; Wed, 13 Mar 2024 20:54:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EFB2280073; 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 CAB8880071; Wed, 13 Mar 2024 20:54:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 9D5DD8D006B for ; Wed, 13 Mar 2024 20:54:43 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7802D40473 for ; Thu, 14 Mar 2024 00:54:43 +0000 (UTC) X-FDA: 81893824446.27.56CB252 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf25.hostedemail.com (Postfix) with ESMTP id 00B97A0007 for ; Thu, 14 Mar 2024 00:54:40 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=WprG9LXx; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=none (imf25.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=IlrnMbOqpJ2/S6gj5kQQ6CnmyYoOw3Yg8bRGX3sCghg=; b=SvwNQyi2FkSQ8yWwXpumRjL17N5SpvFXYIpzkxaSQi5GqIPO03bQH+IAuVEpFpEZMzay0v u4D3NP3uw+yyQOk9dw3FbEUeJBGOeMNoa0z/HBbiaroaI+YT+Q35ehtRdFZ+l+1DW3UPma ltReYWEM4SNxYC4jxOGTeGIxIhbBnDI= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=WprG9LXx; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=none (imf25.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=7gWYPOBY4QUKVEsrn26GtqrcHjyf/YJTLPTNBkD9fxy6XzPJYpckZh9LWffP0HML5b7ZwY G5n8d2QLT7iYpiHmgL1oyfpuN/Ly3BXJSI58QP/G1fPs0JuGSRwfUdt1gDr+1/hvPKzRlg +6/KVJunQ9b6QlnQMrAW6NyA7xWIJGg= 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=IlrnMbOqpJ2/S6gj5kQQ6CnmyYoOw3Yg8bRGX3sCghg=; b=WprG9LXxkpkrd2J/PoJcJt1Zi/ AXp+bYR1AcF0qAtAKEWut8ddrHSpIg3sP5Gnh5Yq3548iivB+Kp3j+ccbsjktXIuOxHHVvdsk//dD LxqHD7UmSi8A7EIthtU7CxqOu5Yw0d1tRuuqrneTbeqayayJVS4GNqL7LfGgsLQHP3sbeVGOv+4/4 O3vLr1RrHBG+6ZJ54ftmdIUUlHRfuav8JasAp0ootpUZOlLrmmFM3LqV76FoZ4IPfRZdtklj9C0Nw 5S6w/VDtaLYk1h+yj7bfW1pJnrpji0jVAnvUPoVqRLeN13XZkX6AkYuggSSXLu1HCkiLmzcyLWHCS 7ZK9ckdw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkZMj-0000000CQo5-0pYM; 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 2/3] mm/compaction: add and use for_each_populated_zone_pgdat() helper Date: Wed, 13 Mar 2024 17:54:34 -0700 Message-ID: <20240314005436.2962962-3-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-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 00B97A0007 X-Stat-Signature: xw7dwoyyqbatyi3k7nedbgppai9ikg3d X-HE-Tag: 1710377680-241462 X-HE-Meta: U2FsdGVkX18Ezlu+TTC6xCysl+ZCvQ9f/zKXNQbeZsXs5ALNvTo9W5aJNEgZdl8NZAbY4hoXVgdQoq+qMPtVHy8C690Xma7/drJ4E71rqVMnFcMgnI7yQXurE3yC2+Gnqz6JnqrB4YEfe4ftjqk5NUyeii727Lg/c7VYYLrNCytltsZrdfyH14t1i7Aj4EN8eexvZdTCg9usMi/fh/Sj1n/NGKUHxyxBi5RL3P3aXBdD4URxZ8ym6MHu9iqF7sQXY7IoVqLO6l4+5t06gA46hfS3uEtr6VHP1tOd6N0Dv+2Nc2tLfeIoFnNqCD2reKS/wEbCvcdohrGGc5dASMsSObKcvvIjTYlkbx/Uj4CJ78EsD2tq6UrfC+FBnpwyCmRfYzKtAse9CTFL2d09QhnGrwHZdaUsNyB9XwCjFE5PGoG+1HoCouJjf4i/kT/Dd7oMNZtpchCtmQEufG/sI7i0lXbsQnIg01mRkna6BnjQg0qHNJcGuemNzk0GpPGcRWKl0ezv5VQyj+sPA/AYO/7wwLlY6Kr4l3jn2z200ur5EMBO6jZF67Fxj10Q+69GyH29wAkiC3xyKU7tq3gcMRaIQUKxmVvMydhIVYFJD8WHBcQkFJbnRmq6WWl332ouSydNhXNRMeTCLvrxN/ezZf4aP6+qjOGGLUMceTsEh89Nej64xd/Pwx/y7brJPSV421u9RX9jbFh0pQxCicYS2CtTKcYHLgYOnl+CjGMSbE8xVj6YalySFzQJtDCrbZ8mZF9jZ9zmYVxSNiqIwBomVTPmkCRIeMuls6H6vMT/QNG5hn5w7IfW9rTgvPjEXQ0qgxqdftiVC8fr/LLB7nyrXcO1Lh69YAQSx2lLCXgMMVgWmOsdYa3LASa/uIvL5XENCOQrlJIJfGOxexG38Pgf1seBMMKd1qr8pVWx8Oag6sqW4rPTYgJCkdR3nyH7ik1STecTTirhrf8ORxjEVgP6nOD p4r4GhbS 94dsWwZbR6vtKE82kvpaPvlXmamys7ZsCpwV+vJI38XzRZPpwLN5Tuxntg/A1wFWybTOjFvWxZIktdxLuxFavIWguG3qS7UDKok/oTLDGEBMSYwEoRZeUchCHJk/oAQ8ybtrMb/HT1FhvpcSV4DstJpHJgLhcP0NJQyL2 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: We can just wrap most of the work done on fragmentation_score_node() into a pgdat helper for populated zones. Add the helper and use it. Signed-off-by: Luis Chamberlain --- include/linux/mmzone.h | 8 ++++++++ mm/compaction.c | 9 ++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index a497f189d988..1fd74c7100ec 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1597,6 +1597,14 @@ extern struct zone *next_zone(struct zone *zone); ; /* do nothing */ \ else +#define for_each_populated_zone_pgdat(zone, pgdat) \ + for (zone = pgdat->node_zones; \ + zone; \ + zone = next_zone(zone)) \ + if (!populated_zone(zone)) \ + ; /* do nothing */ \ + else + static inline struct zone *zonelist_zone(struct zoneref *zoneref) { return zoneref->zone; diff --git a/mm/compaction.c b/mm/compaction.c index b961db601df4..023a09d0786d 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2151,16 +2151,11 @@ static unsigned int fragmentation_score_zone_weighted(struct zone *zone) static unsigned int fragmentation_score_node(pg_data_t *pgdat) { unsigned int score = 0; + struct zone *zone; int zoneid; - for (zoneid = 0; zoneid < MAX_NR_ZONES; zoneid++) { - struct zone *zone; - - zone = &pgdat->node_zones[zoneid]; - if (!populated_zone(zone)) - continue; + for_each_populated_zone_pgdat(zone, pgdat) score += fragmentation_score_zone_weighted(zone); - } return score; } 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); }