From patchwork Wed Apr 3 17:14:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 13616511 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 39564CD1288 for ; Wed, 3 Apr 2024 17:15:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C79126B0088; Wed, 3 Apr 2024 13:15:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C2A3B6B0089; Wed, 3 Apr 2024 13:15:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B18686B008A; Wed, 3 Apr 2024 13:15:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 94FD86B0088 for ; Wed, 3 Apr 2024 13:15:09 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 12BB8140D27 for ; Wed, 3 Apr 2024 17:15:09 +0000 (UTC) X-FDA: 81968871138.24.B19600A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf28.hostedemail.com (Postfix) with ESMTP id 1A74AC0021 for ; Wed, 3 Apr 2024 17:15:06 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=tLVspOYU; spf=none (imf28.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712164507; h=from:from: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=4iptMz7iSD6DXWLkWwgnqB96gIdT8SCjbHmreUMaKzw=; b=ZK388Zvb1tHjBiLjmVbrqIL8AyLkHP/rpyzPbAnOv+hJ43vxwljXbevatBRLktwYBomXtw 2Ucfr0HtTmshTJ3GtTxMI6qabu47GyPk7OIRn+m4H8VQjxwAlYZWa+2+pkGMC/i8qhiIB2 bRYdMFp76gnHoMSpxlzBXqjHBLsU2wc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712164507; a=rsa-sha256; cv=none; b=8Wl9zD6HCP29R0KAXsorMWZ3lTHF8mKmEBji3WL32Av19KWQYXLMUxfBR0oCwFSAusjoDg 2VzwKwz/f/i0ZytIZwUChy0HiMHFqcbCbfa46xhxzsJodQPbJpUlXaXEroX6/byq7xhXtG Uicn2apgpx70guD/FwjT2ZDix6N5048= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=tLVspOYU; spf=none (imf28.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=4iptMz7iSD6DXWLkWwgnqB96gIdT8SCjbHmreUMaKzw=; b=tLVspOYUdHehXPrlIVsS17Syyx qVwDtTnKGCgJR4mEvk69rFbm1UtyJOYvOvsImj4sZVqVRMAfF82EkNnqcsP/GDFZ+xSfCkMFxDlpa rgYab8ZAq3rp8r94El+Zfa1AUrclnIYJ69fnvnyvrqfR5DEcfJsWQ3+O8AdvTWkt0y3gKWc4N2/eY zP8tVnypyNn6Q3D5+0dJ2XEJ6cEtiOUUeYUOhnPHsuyIGGksFX3KKeTRSbC5lLEUk8URVbJBtCthJ rNJpOkE8CCsA5lgBHr+lcyNXvEyPyh86qN13KNgPC5K/eBH1+Q8VtRp1f+Wdd+ki8k8NTpc+kRXsC 6oKiA7EA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs4CQ-000000063wb-1M8s; Wed, 03 Apr 2024 17:14:58 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton , Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 3/4] proc: Pass a folio to smaps_page_accumulate() Date: Wed, 3 Apr 2024 18:14:54 +0100 Message-ID: <20240403171456.1445117-4-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240403171456.1445117-1-willy@infradead.org> References: <20240403171456.1445117-1-willy@infradead.org> MIME-Version: 1.0 X-Stat-Signature: twkx76cs1nc6e9xtx457y1pqoenuqy1m X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 1A74AC0021 X-Rspam-User: X-HE-Tag: 1712164506-760979 X-HE-Meta: U2FsdGVkX1+gonffefyxLEJ3IlPy4v+q8NZ6tP5DRb2aAIMR0/qu6VekE6ZlIcQ6eurwyv3uRH7hSsBS7OhzKUcWzhOhLYYt0+NFxjtIR4/u5tEEqIUBXMlwHKWP6DzS37DN4gNi0M/jcBLvzebVSPlGJEw+KzDP2bIJPznqHoHeYSUeLfAgg3bdTtTR0/oPjus/lBCF8BDRtRmW1Z1dsmfhaUmewSuoiWqx14W1kPC+BOkgbTPXphm3FGsW9MyMK8KXshht6DDOAsHasSh5/7n+Y9ll5EVag0mcPkH1n1jOrcGV3dXS2KQCZcsqD9nKZz/MVpvh3vdwdM6OdAGMF9Fp8L5xV0vKrMV0+3s2PFUjqG2uEXc49kWA+SRA3mKB6apLT+8KVeoQW+AK0ss3T0W4Apkk63XmOgO8kM+cNYKMm6o/Wnoho2+zaiqyBHcNMFjxZcXmcM7U+Y1/oePPNGqsAFSsgYewFG0OnP1ifBwcgvNXNNc8YpuGkkrvzGNqVMclI0XN25hYYv9TvP5kU2sl2aX9F5ADEWITt3XiESWLGPKnAmeI1mYxyD6aSSW+yWgTcJEunk4X/MNz5JaYltM4JRHuPmyhzOT6zrYaPV8NJUJFOaKSpMWKrTUJoERlmXwUIV0yV3TZnGk6l0iVAgW/h923PpGaOCWDeSXVyExWCLTvds9FHHboIPdxLn8CuYYtc5Dkzt/Ko7FroTexx3XoAGbZjkqu6nNoAzR0voQgVG9QQzP3UAUXrCbKr57Sj8mmiJVIcV7lV06pWp2uUJsd1aKj68pk7UeMVDrFIaU7HFH+Xu54bIM86NawTY03ZFqFNQvnCB8TUjU9fNhlfsRvD+Eud98kYFGNlcIJGa44wRk6zchp7oJFhyQlR1E2tVVUrZ2cZ/d+k3vKie/oSQG9DUHZ24tm 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: Both callers already have a folio; pass it in instead of doing the conversion each time. Signed-off-by: Matthew Wilcox (Oracle) --- fs/proc/task_mmu.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 2a3133dd47b1..6d4f60bc8824 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -411,10 +411,9 @@ struct mem_size_stats { }; static void smaps_page_accumulate(struct mem_size_stats *mss, - struct page *page, unsigned long size, unsigned long pss, + struct folio *folio, unsigned long size, unsigned long pss, bool dirty, bool locked, bool private) { - struct folio *folio = page_folio(page); mss->pss += pss; if (folio_test_anon(folio)) @@ -484,8 +483,8 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, * as mapcount == 1. */ if ((folio_ref_count(folio) == 1) || migration) { - smaps_page_accumulate(mss, page, size, size << PSS_SHIFT, dirty, - locked, true); + smaps_page_accumulate(mss, folio, size, size << PSS_SHIFT, + dirty, locked, true); return; } for (i = 0; i < nr; i++, page++) { @@ -493,8 +492,8 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, unsigned long pss = PAGE_SIZE << PSS_SHIFT; if (mapcount >= 2) pss /= mapcount; - smaps_page_accumulate(mss, page, PAGE_SIZE, pss, dirty, locked, - mapcount < 2); + smaps_page_accumulate(mss, folio, PAGE_SIZE, pss, + dirty, locked, mapcount < 2); } }