From patchwork Wed Apr 3 17:14:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13616513 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 2DF69CD128A for ; Wed, 3 Apr 2024 17:15:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 07A776B008C; Wed, 3 Apr 2024 13:15:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DFD446B0093; Wed, 3 Apr 2024 13:15:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB5BC6B008C; Wed, 3 Apr 2024 13:15:12 -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 94F8D6B008A for ; Wed, 3 Apr 2024 13:15:12 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1970380CE5 for ; Wed, 3 Apr 2024 17:15:12 +0000 (UTC) X-FDA: 81968871264.12.CD045B6 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf05.hostedemail.com (Postfix) with ESMTP id 3637410002C for ; Wed, 3 Apr 2024 17:15:09 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=uv9Z4GOP; dmarc=none; spf=none (imf05.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712164510; 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=wbcNRsb1B9OYyyrrlq1n5AUXVLnlKeePbbuQlBkeIGo=; b=ZjLzcQ+Sp0xa1RO8YI3TOkDmIzlo8v6iA2byw6s7NWfVxwJCKoJY4MJre4aGpsAA4AX220 YaBtUOWMc6DnaBvEm7MRPZ+1jaXCx/8VYQdzJPdHae155xGd1kz9ai/Og7o0yNknjVkFtO kUnFFofo9XcmFmzlAO7DbS3WpVKxOJk= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=uv9Z4GOP; dmarc=none; spf=none (imf05.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712164510; a=rsa-sha256; cv=none; b=wGChLME8EmJgOuw6ThMqGQrKtKazBpLPoQqWbw850pMLp9EhwaA5fi2Qrn6xW2L5EL0YFB adN7oOjR3yLQeSHeoJLTEenr+FBQvGtcciqTgv6JOWMFmCR7sjbD6hGvDdYz189l+W+SKj 5FF+QR6EEpBCHXuQDBj1yPatjWcEYtc= 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=wbcNRsb1B9OYyyrrlq1n5AUXVLnlKeePbbuQlBkeIGo=; b=uv9Z4GOPcU9GrYuVe8vFQvs4wb FykzKMLugI66A2IzTVi0QUC1kE9TBiYbaKEtcUK9zNvPJ1EkotCNOGAcZT8SHdsGMEUTjFagya8mL 11sii8ap6W1w9r+zeGgY9/t7ZpLQOIz6iA86bjk8KQoCfF7Y6+CQeHW55t9S6wSgcQ/YyT4wYgJTf PQZPiW4kNV//tGP6mRut5v0i2+tRoZvo6O2rnOFKivIFdAFW/w2WzRvm+7NbqKrf9YfRPBFLTGaw8 z5WiAAx1WFoOcWJhsC71C47cOizzZAZQ668LTjiXdOuBg2lXoC6kewTMi28sHFFRLGr7e2BoyQUv0 9Zh38Byw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs4CQ-000000063wZ-12bp; 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 2/4] proc: Convert smaps_page_accumulate to use a folio Date: Wed, 3 Apr 2024 18:14:53 +0100 Message-ID: <20240403171456.1445117-3-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-Rspam-User: X-Stat-Signature: wxibdx5fhmz7ogrx1fq5c3he7ckpa17w X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3637410002C X-HE-Tag: 1712164509-609771 X-HE-Meta: U2FsdGVkX187QIC7DRVTz3cU8C15qrL9A3g0FBpWR0XUU/d7iP9kxKl36tG5gztj6FDUmCK8C0JUy3OtslrR5PpenP1UKLUtHkrks19EmLkWINn8ISbsaZwzTkbzUn0yMxayR6NQTjfUxAiRcOarwpcu3g1mOV9OH8W6Co4coqxbCm5JiuzGiPjOzk5PKTVkIgTs+tI8cUVm03991s8yUo6ge5GMIH0J67ok927tU9PkMc9cPCIxzp2LMpfwZ7CTerI1EIwmwnUG6JRpGiPbSPK/n2+IlW4I9NSGHuHH6fx/Da/qAeDFx2ZfSLhefAe+vBuSB43iDjKrVMHIRehh2WAGSFiUF/WJmm/be+rMSqL5jkKyV0rm3i22v93U7ehuTa3L6DfCsTurTk4YKf9xSvUm/QQ+c/0ZP0b9uYmpIrCM2/ilnZHWPVfWvIEPjs+oYrIzVj7lpuiXe6dRKsn6MLjokCPMjeHuWiViMXoqg0Vp3uHUzdGeeN5M7xB8jcwKi58uk41Bf6IeLKzthiTakUHOlra/jPxJzRWTKDBL/OWaPPZVCkJTCMejwBn9S8VPW3NkdneUEA9VXeS4e5tUd9nFzvpWfSreySbsa9CmsT8TU7aOH6rDXe1gVvg3ZtQbYymhlD4lJikaqcY+D2AirthF71c76k+rsC4ko7J0Du+tC+HXv0VyLBRelUwp0RHVbYNV3H3ZxrT+2zEcRb0bK986rQKh1QLE3nCV7paWzNuM4aYHfrYrZaIHaxi0N40hNFqQ1bRUqRtIBa+/3ad0jFYFlGgZToYORW4Xc38JW1Vl8ioCNZmEKtbhVjQBjPw4t1JrWxDKBrmoQhW5vHN3xiX4vvW7jA9g8dbJvprlpxxL4doAQwMeDk0cvdfUuaeoR5DzJBZUyc7OGsI5gBzizk99XLZoNglqzhoFiiYqXX/5TZ9QVI4rb1PX4Vo9MFR5Fd2yN1+dD1CNYIgiL1i Ng5Z6/3p HQvxSUJdgkJc65hXJIf5vgxh/ntl/xMbPqQCI3BR0/Z+TTPKvqJDm75K+vAEBtgYeuyJNa2RJQvUwe9sHNmrPTj/htOKZUJv0wv+cbSZ3ud+K/iaHkF0QyJX7I4Ca8+sUgTxu98/nhjtqPHUfNPSriPTczDVG/mAsPFVy4n0BLQIRCn/isDaJaAg6YWt2q/8jRJf+kD0wjSQzVSIFUyoGsOk2PrFp2UU4q7en 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: Replaces three calls to compound_head() with one. Shrinks the function from 2614 bytes to 1112 bytes in an allmodconfig build. Signed-off-by: Matthew Wilcox (Oracle) --- fs/proc/task_mmu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 5260a2788f74..2a3133dd47b1 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -414,11 +414,12 @@ static void smaps_page_accumulate(struct mem_size_stats *mss, struct page *page, unsigned long size, unsigned long pss, bool dirty, bool locked, bool private) { + struct folio *folio = page_folio(page); mss->pss += pss; - if (PageAnon(page)) + if (folio_test_anon(folio)) mss->pss_anon += pss; - else if (PageSwapBacked(page)) + else if (folio_test_swapbacked(folio)) mss->pss_shmem += pss; else mss->pss_file += pss; @@ -426,7 +427,7 @@ static void smaps_page_accumulate(struct mem_size_stats *mss, if (locked) mss->pss_locked += pss; - if (dirty || PageDirty(page)) { + if (dirty || folio_test_dirty(folio)) { mss->pss_dirty += pss; if (private) mss->private_dirty += size;