From patchwork Mon Feb 14 20:00:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 12746057 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 0C62EC433EF for ; Mon, 14 Feb 2022 20:00:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF3686B0081; Mon, 14 Feb 2022 15:00:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D4A306B0082; Mon, 14 Feb 2022 15:00:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B5A16B0080; Mon, 14 Feb 2022 15:00:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id 5273D6B007D for ; Mon, 14 Feb 2022 15:00:23 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 0E85982DF86E for ; Mon, 14 Feb 2022 20:00:23 +0000 (UTC) X-FDA: 79142452326.30.15766FC Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf05.hostedemail.com (Postfix) with ESMTP id 29F7610000C for ; Mon, 14 Feb 2022 20:00:22 +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=Fzp7C16v2HDmAqsmLy5ntKGanYQxtjdNpkW0IzZ1aD8=; b=VQX7Q+575/EpFRQmAXEVGtk36M DE0TtELNkMCdY5fFN57uA8UYu/K99ZQ+ZNMFV06BbGVdz9fhhKR8RD1+USgBsGcvBsbLY7T13SlFx Q87kd41HrnIWDMOXsI6Zk+IlWlE9W84kots0ThOEhb9qU/+OvIAN4K5d+xN+4vxygYMAcnaFybdl6 qD/jgODhcMG62sCuGGC4Ksm+duhtt/h1W1uSO15suOJa8/aLpfS0+isV+fO7YLUixqPVr4SJMadei H2Ey/zprmA6Ut1ATVbDNAWTwbI6+4RWf+Qxzd1YLjbJ9ur0k96GqsYFM/9jwhN/i2MhRCJRe72K7g jhCG9CsQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJhWG-00DDdy-Jj; Mon, 14 Feb 2022 20:00:20 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 07/10] mm/truncate: Convert __invalidate_mapping_pages() to use a folio Date: Mon, 14 Feb 2022 20:00:14 +0000 Message-Id: <20220214200017.3150590-8-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220214200017.3150590-1-willy@infradead.org> References: <20220214200017.3150590-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 29F7610000C X-Rspam-User: Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=VQX7Q+57; 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; dmarc=none X-Stat-Signature: 1uxdzs8kintzmz1sh9fdr9niumc7599f X-HE-Tag: 1644868822-857639 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 we can call mapping_shrink_folio() instead of invalidate_inode_page() and save a few calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Reviewed-by: Miaohe Lin --- mm/truncate.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/truncate.c b/mm/truncate.c index b1bdc61198f6..567557c36d45 100644 --- a/mm/truncate.c +++ b/mm/truncate.c @@ -505,27 +505,27 @@ static unsigned long __invalidate_mapping_pages(struct address_space *mapping, folio_batch_init(&fbatch); while (find_lock_entries(mapping, index, end, &fbatch, indices)) { for (i = 0; i < folio_batch_count(&fbatch); i++) { - struct page *page = &fbatch.folios[i]->page; + struct folio *folio = fbatch.folios[i]; - /* We rely upon deletion not changing page->index */ + /* We rely upon deletion not changing folio->index */ index = indices[i]; - if (xa_is_value(page)) { + if (xa_is_value(folio)) { count += invalidate_exceptional_entry(mapping, index, - page); + folio); continue; } - index += thp_nr_pages(page) - 1; + index += folio_nr_pages(folio) - 1; - ret = invalidate_inode_page(page); - unlock_page(page); + ret = mapping_shrink_folio(mapping, folio); + folio_unlock(folio); /* - * Invalidation is a hint that the page is no longer + * Invalidation is a hint that the folio is no longer * of interest and try to speed up its reclaim. */ if (!ret) { - deactivate_file_page(page); + deactivate_file_page(&folio->page); /* It is likely on the pagevec of a remote CPU */ if (nr_pagevec) (*nr_pagevec)++;