Received: by 2002:ab2:5c0e:0:b0:1ef:a325:1205 with SMTP id i14csp148896lqk; Wed, 13 Mar 2024 21:00:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUhwcAjLFJ1eHxssjPTFY4sSPfKFrMNHOUhWV6ht6bg9/lU2WkxJS+U+Pz7mnLbRFcMskFr3Iooe/kFnNoc5i9bPqNN4x2axXUeQA3RJQ== X-Google-Smtp-Source: AGHT+IGRAKXTgBx8LjIlNKIEmRAMUIpvt8WDOwjunWEMxNyHNKfLp2GH17D+dpU00qVJAQCd5aAp X-Received: by 2002:a05:6359:7c20:b0:17e:4b00:843a with SMTP id xm32-20020a0563597c2000b0017e4b00843amr1044483rwb.5.1710388818990; Wed, 13 Mar 2024 21:00:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710388818; cv=pass; d=google.com; s=arc-20160816; b=ZzoPbTsjFyJ2gyBArMIDFTIJeMo4wTtPYM22IiEqtdvzCkOj6vics5jB7oiH5efCiI FhRVgu48iApnPhbsVc5La8v9RdssOwIOFE+znDo2G3zqJ2WPEOAeTg9kzdtTQdMoxH+x 2PMGYZy5x1M93R2aFVlcHOPGzZFWfSTUXOvQkmZdekeOrfR6CFDcIFbh4KL3aGg/wLmM QwQ3BRyITioImsaOetHf4YjFmMHfkfNpR1TL5O6GUnxurvfpUlnsDB+3tokk433Cj1PG YdH05JbwZGlTiLTiAD5lWB4K1mfDEu3W0i/8l/tV7GJLnmdYBs2OKNVEbf+aV4zVZD+L jDeA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=y16FDE8fAPRzoyd3hzzZJsRMIkVkBbl8vnhWWzqELbo=; fh=4o9ju8uW9tMUTrj362tSKuZawyKTvPM2ZAEJFdvfDvU=; b=apaLvA68MjLlPpERvXxPd7w9exqFj8SxOBP3URgIH13z9C0FT18wMAod8LCGa2OR1d HKC92464JsHHGbR3ttfzYWPL/wnMZzB+/x1G3S4Wmbp4iZqov8oJ8d/uEcC10vEjrtdZ Oi889zItRk3KshLfD7MUAGWwvKXVq/Sc5rjkyV6bhkzO/mQNYXj9G9Lr8tlGI530HXKg Sk0sOZghGHYVq50mygeisQ133sNSfuKKzcRWchnuFUgIYHbnIXDZPReRQxVbQ/QYgKNt TlRiZklVIAoElSTar1x8it6D3bcBhHWGba2sJqrKKJxW+8n0WLgpgSqtb2NfSzDcVxII uSVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="dAi9n/RM"; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-102689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i2-20020a63cd02000000b005e438e94b1esi691515pgg.382.2024.03.13.21.00.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 21:00:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="dAi9n/RM"; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-102689-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102689-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 5539CB225D0 for ; Thu, 14 Mar 2024 00:55:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 09F82D2E5; Thu, 14 Mar 2024 00:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="dAi9n/RM" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD22B8F55 for ; Thu, 14 Mar 2024 00:54:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710377683; cv=none; b=TZutsL0DVe3556rP8BiVZyNMxUasdvomBiCWQdK76k5CqI+7Df3p5gUVTe1FPI/u0z5JLLXFXT6KaU8kvwG4cPDQwosEuFFwhfGTcNdsNVQlkIJFLzE6W1cBL4bToGiCjEO4Qdbz0YTvcmp15AixHHIgGbNQ8RwzhO6kNw96Egk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710377683; c=relaxed/simple; bh=urZYEhkOjhiW7omV6Hau96GGQsXjogpoamI/c12JFlY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hvTEqFniVTh5bGlVz96HZ3Wd1MIWTnykGVvyiKX18aJh8idM0NLz1X0G4BmfYAlS/Xokw7ATWOhr6G5xEmXe1g0cjw/uuDIuMP9gL9JCUjUgg2zvgRTzWBXA5du2BrxC14x6IYNoTqKMg5YntUXWBA+SJKKqFoJIBmUWA0An9Sc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=dAi9n/RM; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain 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 --- 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); } -- 2.43.0