From patchwork Fri Feb 4 19:58:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12735520 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 E923AC433F5 for ; Fri, 4 Feb 2022 19:59:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 817AA6B0087; Fri, 4 Feb 2022 14:59:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 44DDF8D0001; Fri, 4 Feb 2022 14:59:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E80116B007B; Fri, 4 Feb 2022 14:59:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0181.hostedemail.com [216.40.44.181]) by kanga.kvack.org (Postfix) with ESMTP id 35FE86B0083 for ; Fri, 4 Feb 2022 14:59:06 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E81AF824C451 for ; Fri, 4 Feb 2022 19:59:05 +0000 (UTC) X-FDA: 79106161050.13.04D6382 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id 9667DA0002 for ; Fri, 4 Feb 2022 19:59:05 +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=1PqJy3qyxx9ZfB1pTIydk4AC0uSd8CQ4ZT1UzFOW0k4=; b=U/3g5iPw5GVCb0lDCfcs7uWpnM eRhaK7lZHruqfwgnJDtz+TH65rfWNL66KAcHpf/lN2psj5vbPgDWOQAw5p7IoU/dugf/TZkZ1xUHE YeBej2IYzSbhEuKQ9Wf6rnTT8vwLH/lqGXvKz+428aVcyoBqL1wiVhcEEA0oljN372gXp3M4RzhMj OAqgei9MsvBGI2BgvshCb4Oao5qf77t8mXD7tf/Q6uBV+Fmb2Kcr/wc6pfK8vkr2K1aWxG7BLEbHL Obk1g1nAORZaB3rBqmEOc3PSLAPLCCA9nooEFmQhpWeyp3fYkB+gnLQXQA/xfW5kBUcpOw/S/qgNI wK/+6TgA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nG4jY-007Lna-2y; Fri, 04 Feb 2022 19:59:04 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org Subject: [PATCH 44/75] mm/rmap: Use a folio in page_mkclean_one() Date: Fri, 4 Feb 2022 19:58:21 +0000 Message-Id: <20220204195852.1751729-45-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220204195852.1751729-1-willy@infradead.org> References: <20220204195852.1751729-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 9667DA0002 X-Stat-Signature: 5ykq5y5sdnu7afzdrnun3bizwssgjs85 Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="U/3g5iPw"; dmarc=none; spf=none (imf25.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: nil X-HE-Tag: 1644004745-383680 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: folio_mkclean() already passes down a head page, so convert it back to a folio. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- mm/rmap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index d62a6fcef318..18ae6bd79efd 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -931,6 +931,7 @@ int page_referenced(struct page *page, static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma, unsigned long address, void *arg) { + struct folio *folio = page_folio(page); struct page_vma_mapped_walk pvmw = { .vma = vma, .address = address, @@ -942,7 +943,7 @@ static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma, pvmw_set_page(&pvmw, page); /* * We have to assume the worse case ie pmd for invalidation. Note that - * the page can not be free from this function. + * the folio can not be freed from this function. */ mmu_notifier_range_init(&range, MMU_NOTIFY_PROTECTION_PAGE, 0, vma, vma->vm_mm, address, @@ -974,14 +975,14 @@ static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma, if (!pmd_dirty(*pmd) && !pmd_write(*pmd)) continue; - flush_cache_page(vma, address, page_to_pfn(page)); + flush_cache_page(vma, address, folio_pfn(folio)); entry = pmdp_invalidate(vma, address, pmd); entry = pmd_wrprotect(entry); entry = pmd_mkclean(entry); set_pmd_at(vma->vm_mm, address, pmd, entry); ret = 1; #else - /* unexpected pmd-mapped page? */ + /* unexpected pmd-mapped folio? */ WARN_ON_ONCE(1); #endif }