From mboxrd@z Thu Jan 1 00:00:00 1970 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 4BC4BC433FE for ; Wed, 4 May 2022 18:29:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7FDB36B007E; Wed, 4 May 2022 14:29:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E9D66B0092; Wed, 4 May 2022 14:29:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B36446B0083; Wed, 4 May 2022 14:29:05 -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 19EBA6B0083 for ; Wed, 4 May 2022 14:29:05 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id E3CBD6128F for ; Wed, 4 May 2022 18:29:04 +0000 (UTC) X-FDA: 79428897408.08.0829275 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf17.hostedemail.com (Postfix) with ESMTP id 3871740084 for ; Wed, 4 May 2022 18:28:51 +0000 (UTC) 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=pGA+ufhTLejZs6UQD/U24KGfzpBgMkKhRJ/yYi2BWVE=; b=uIFU0sr+qfdsys2Xdv355OZrt/ uCvK2bpJOSADRsRcUFbNZdSwUOQ8J03hdqfPbq8wIViTqIB60yUWbEI0XaeOfxi8GELlhpqAlLoHT rM88ZzFT5Fqabvyqst359880KhWm1u0EaUnjOqzclCGeR+RvjO/oYFOl+6afqnw7xmV37JQp+5QlJ PSwpHciDCGVduHgZdYozV/8Oo1nHRQXyMNNxKM299uFBXu0by44aK/smKBHJSCgKXFot9XmWKL7r1 /iGOGOdsnhOsvg+xTAwbIbswku1Tb6Qogtkmj29kFvNTOShFvERpUnFZYKA9Bv+HsSrkXrTqRPaUf eVNDjcFQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmJkF-00Gq6w-0K; Wed, 04 May 2022 18:29:03 +0000 From: "Matthew Wilcox (Oracle)" To: akpm@linuxfoundation.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH v2 12/26] vmscan: Move initialisation of mapping down Date: Wed, 4 May 2022 19:28:43 +0100 Message-Id: <20220504182857.4013401-13-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220504182857.4013401-1-willy@infradead.org> References: <20220504182857.4013401-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 3871740084 X-Stat-Signature: yzjmnzdfm63u5w8fxtmp9tno8qtudswn Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=uIFU0sr+; dmarc=none; spf=none (imf17.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspam-User: X-HE-Tag: 1651688931-751876 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: Now that we don't interrogate the BDI for congestion, we can delay looking up the folio's mapping until we've got further through the function, reducing register pressure and saving a call to folio_mapping for folios we're adding to the swap cache. Signed-off-by: Matthew Wilcox (Oracle) --- mm/vmscan.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 0368ea3e9880..9ac2583ca5e5 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1568,12 +1568,11 @@ static unsigned int shrink_page_list(struct list_head *page_list, stat->nr_unqueued_dirty += nr_pages; /* - * Treat this page as congested if the underlying BDI is or if + * Treat this page as congested if * pages are cycling through the LRU so quickly that the * pages marked for immediate reclaim are making it to the * end of the LRU a second time. */ - mapping = page_mapping(page); if (writeback && PageReclaim(page)) stat->nr_congested += nr_pages; @@ -1725,9 +1724,6 @@ static unsigned int shrink_page_list(struct list_head *page_list, } may_enter_fs = true; - - /* Adding to swap updated mapping */ - mapping = page_mapping(page); } } else if (PageSwapBacked(page) && PageTransHuge(page)) { /* Split shmem THP */ @@ -1768,6 +1764,7 @@ static unsigned int shrink_page_list(struct list_head *page_list, } } + mapping = folio_mapping(folio); if (folio_test_dirty(folio)) { /* * Only kswapd can writeback filesystem folios -- 2.34.1