From patchwork Thu Jan 11 15:24:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13517544 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 68A36C47258 for ; Thu, 11 Jan 2024 15:25:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0BDEE6B009B; Thu, 11 Jan 2024 10:25:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 06E156B009C; Thu, 11 Jan 2024 10:25:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E9E576B009D; Thu, 11 Jan 2024 10:25:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D83676B009B for ; Thu, 11 Jan 2024 10:25:05 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id AD818120B7B for ; Thu, 11 Jan 2024 15:25:05 +0000 (UTC) X-FDA: 81667403370.20.A973265 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf06.hostedemail.com (Postfix) with ESMTP id E0B7A18001B for ; Thu, 11 Jan 2024 15:25:03 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=R0nsiLkS; dmarc=none; spf=none (imf06.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=1704986704; 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=BfP/fGwBklnFZaYvawDWMaMKV/+8upyp4Stw7tV+DLE=; b=hGCh6oi1ZZIGoSJNpcvK9do9YHA0naimYSq8+zXs6oC6Q7ENu8hZQFNeTv3AtAKwKXGSPR 6f8xLrk+fX4QjXHi5bE6yFDMxmPc09EF75BxGfSUf1irk1OApd92fMz7lJAQfP9zAukPOp qwPQKg6+8GrYggGHYXg6oCOzm1uW0T0= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=R0nsiLkS; dmarc=none; spf=none (imf06.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=1704986704; a=rsa-sha256; cv=none; b=GJJQh2xTZ4wpP5NjPKcdRu2m0MI8GM5NDdyEKRPmBpiD6mPCUMY5sD6SDqdy01AJsfYZZj XKlWF0KEUHbYPKP7FT1j6TwipWPBw0Ek3/BNQOSl/ZNfC8yn0CIljENLpBWmgDyz/oUx/b f1G7qlsq8iQzY4fTvPAV3q+2qN7M9fQ= 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=BfP/fGwBklnFZaYvawDWMaMKV/+8upyp4Stw7tV+DLE=; b=R0nsiLkSkD/AHtpue3+mNyRKTe E7sf7B2vnUbfKLKR3BihhqaUE29FmRIivR60JM4+O2M7YKN4FE0o9W4to9d0k2VYv1iWe0QV9zOTE mIIy6vy5ujGuW8RGVk/WS0lAHnJVwluedehEzchUYhoT7Dbpl/I8fC/9MOaGFI12tGKynmU8Q7dGL cRaxSEq7Fpa5LTjmob0aYXGAZmmTKdIX9tSMFwFQqwMFpR3lt6f+0rupEYOiz+s5cU9kEnr/XjlKY Fd6ZjDwTBk8CxmhoU6DV89R2O8KvFIF2RN7xz7xb6LWeCrSanosJuVWZed4/BjUJfSwNTuHd1njUU OFcwIE0g==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rNwv1-00E9sk-G8; Thu, 11 Jan 2024 15:24:31 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, Kefeng Wang , david@redhat.com, linux-s390@vger.kernel.org Subject: [PATCH v3 03/10] mprotect: Use pfn_swap_entry_folio Date: Thu, 11 Jan 2024 15:24:22 +0000 Message-Id: <20240111152429.3374566-4-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20240111152429.3374566-1-willy@infradead.org> References: <20240111152429.3374566-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: E0B7A18001B X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: g3uqdjh7bbn3h166emzjggp47nfngp44 X-HE-Tag: 1704986703-316804 X-HE-Meta: U2FsdGVkX1/U1cnJ+8trNJKEE+Tpvypzg5FDO2d+wyoD2D4XVCQbQqJCY93kuxTzTXJKhXq8KqrijOTvF2CR7AnKgwcAJSXc0eskINk6eLPyklbXu3MYVdN463rUwTk0NTqAgQoaZgqmcuDwCnaPfFUmF7FGsCHhNBEGYAfYyN5Q4xvUZ0YRzsqHUR32yOLF2QOvwO4uvcBIN3CXE5VPvSQLl656KdVCtfjvWdwq7yiZ2Uz5Cz8XD6OvlKHg6JfVugJq9beSAnLi9wQbZ3O7sEY7sV7/qw+jHEzv4LvBJYsYTGUOZqkAEnPNYkyrHTXApBnuBzwPMC2wCNKQZ0fdrCsVkyxfPa/DgFjqzqSTCaRVpyxNyWAdvhn5I8ww6c51TwCOCJJdCLBOVwgpHISaVH0PGZ74o/0IzEXQTSosS+Y1lhINjvPOZPq+vspQSZA6fWtbPLQCNMvdYr8Sad11WHSF7nJvP1UAvCUGdwt5fZYCQHNhP6piBWNIeGTOqKswoOh9lzccdM33WWIhBPt2RWwXRWoOxYoZnFHRYctmJ3RsaifyUldTsqIp/kfNRRkMSxvZnGB0VI1V8eW0lRVSefbTLbp4QHlsIOeYDwlpk01/fGUX+t+Y5CSJDEZRqdcpqX0agYdeemzhsADR3ygu9DZzNhEVh2n+lHou3Bu5dHjhL08BUDdb8/g2dUR3zwRxkmUPbYuHQ8umjqijju8kg2P9t76Sv4Ha3GMnUVI96KeprNExcL0dKBDlpPko8d4Y5NPnF4Lf7v6lcUyU5QczkiYF/ukjTS6jnGrP3QWUL2bMdj5/LKQOa8k/8woUL5STxPu6INcGngOW/cjYZ51ElmEEIZ0gIir/BhT9q6PRhHavzupeyTkxM3HBNBMyeuIhwBqyBbzuZnmPfe5FCR1XKHi6Hy7uekte6TG6xnkaflkvA18suQcb2dPHObHLwXyiEDAKK4rMdAiUGo3Y8f3 KKHYeuOi 6NWhTr2nmIGp6dsbdvCf6gro1iqbL55fFM/qS3BlFSkmvq8EK3/0V6Fzh9OpijVH3FeSNxSvlkr079vsNXZZ95C8q2PhcBUrvO7fB9/HLak5GTvXTEL5Xl/wVfn7yfKJNhwbQGFvoS5AnslJ5Kr0i6/KyVPWpICvUM/R4xskWmfPM9dtzfZJqN195Tf4pfS0n4zVtjeneCaP5CpEYQ4VU+UEoHucxojyotqd/ 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: We only want to know whether the folio is anonymous, so use pfn_swap_entry_folio() and save a call to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/mprotect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mprotect.c b/mm/mprotect.c index 81991102f785..f8a4544b4601 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -198,13 +198,13 @@ static long change_pte_range(struct mmu_gather *tlb, pte_t newpte; if (is_writable_migration_entry(entry)) { - struct page *page = pfn_swap_entry_to_page(entry); + struct folio *folio = pfn_swap_entry_folio(entry); /* * A protection check is difficult so * just be safe and disable write */ - if (PageAnon(page)) + if (folio_test_anon(folio)) entry = make_readable_exclusive_migration_entry( swp_offset(entry)); else