Message ID | 20231220224504.646757-21-david@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 43B15C3DA6E for <linux-mm@archiver.kernel.org>; Wed, 20 Dec 2023 22:46:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CDCDA8D0014; Wed, 20 Dec 2023 17:46:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C84BC8D000D; Wed, 20 Dec 2023 17:46:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AFF678D0014; Wed, 20 Dec 2023 17:46:05 -0500 (EST) 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 9A81A8D000D for <linux-mm@kvack.org>; Wed, 20 Dec 2023 17:46:05 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7868F1C0BF1 for <linux-mm@kvack.org>; Wed, 20 Dec 2023 22:46:05 +0000 (UTC) X-FDA: 81588681090.16.BB05A7B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf12.hostedemail.com (Postfix) with ESMTP id BA9754000D for <linux-mm@kvack.org>; Wed, 20 Dec 2023 22:46:03 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SB34udq1; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703112363; 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=9Tzzmpk6zqHgghmJ+i7focJ8fdDU2jQOAW0uh5TyPi4=; b=feZpcJQfUMQo6xy5tN9XSRFfjLTHfTOrGZIxtCLX2Hc5zZfKkr5Ofzbh3Mtu0AxzHUYOtK 6UzyCiPCk+zRQKOmIrAwUTKDiopnP44Y+LJQsUI++5d4aqJG28A+z/kpWzCaII0GmfpUC+ vTfEKNUxYhb5lvrj0rn78XZTWBXwZAc= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SB34udq1; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf12.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703112363; a=rsa-sha256; cv=none; b=5QdBdBogL30LJwzQTp2L4wUfnOxhzr+HnU4xuw4dl/DqtIDL7qpVQkEc1cK5yNkSuhMTUU JCHYv0q7qscD3Y5SHPnlVv9hncZPxKH7TBM/dIMC25QHPD5bc2EtGjcYwKoa0r3miqNFxE tZlifzSdxZnbEs8FwABc0SQYcSpOYqg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703112363; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9Tzzmpk6zqHgghmJ+i7focJ8fdDU2jQOAW0uh5TyPi4=; b=SB34udq1VaUYdz2so8nwFIU2I2bhmBDQ5Y/83KIPnAlCF+No+Cszw3ToLKqJ82PgGj1aZk s7p77Apxo9Pp+P0MK+cBsetEnfOseERASUluSEVKDJQGAyeNR4QTKi9xcHXPKVRRhAmI6X dxC4rPQypYIGe3m+dxBbCREwTzGkSBQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-492-LliV0quuP_Oqxcmuv5B2DA-1; Wed, 20 Dec 2023 17:46:00 -0500 X-MC-Unique: LliV0quuP_Oqxcmuv5B2DA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E106486EB20; Wed, 20 Dec 2023 22:45:59 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.192.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD18440C6EB9; Wed, 20 Dec 2023 22:45:57 +0000 (UTC) From: David Hildenbrand <david@redhat.com> To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand <david@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, Hugh Dickins <hughd@google.com>, Ryan Roberts <ryan.roberts@arm.com>, Yin Fengwei <fengwei.yin@intel.com>, Mike Kravetz <mike.kravetz@oracle.com>, Muchun Song <muchun.song@linux.dev>, Peter Xu <peterx@redhat.com> Subject: [PATCH v2 20/40] mm/memory: page_add_anon_rmap() -> folio_add_anon_rmap_pte() Date: Wed, 20 Dec 2023 23:44:44 +0100 Message-ID: <20231220224504.646757-21-david@redhat.com> In-Reply-To: <20231220224504.646757-1-david@redhat.com> References: <20231220224504.646757-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Rspamd-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TzYZvk9n0x gSMgKooX GKFlMNlLn29ce+gojEVpGDKuF91p4w7m3hEDNFoQqZ3zNWrFu5MpsZA0+Xfm5wEslXxEd19t7Xz7/e4/8AWwgikFImHKiW0XInQTLlGi+V0VoC+WafRYIqevmKbOW3njBos2tP1vR0dobDm3kkl3rxMpp/ecbXp5xZ5y2c7MOU8sxMJPYP59Ja6sya4CFiSwNZ8h/z04qNGf7ZTaGnatnw15UXw== 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
mm/rmap: interface overhaul
|
expand
|
diff --git a/mm/memory.c b/mm/memory.c index c77d3952d261f..6552ea27b0bfa 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -710,6 +710,7 @@ static void restore_exclusive_pte(struct vm_area_struct *vma, struct page *page, unsigned long address, pte_t *ptep) { + struct folio *folio = page_folio(page); pte_t orig_pte; pte_t pte; swp_entry_t entry; @@ -725,14 +726,15 @@ static void restore_exclusive_pte(struct vm_area_struct *vma, else if (is_writable_device_exclusive_entry(entry)) pte = maybe_mkwrite(pte_mkdirty(pte), vma); - VM_BUG_ON(pte_write(pte) && !(PageAnon(page) && PageAnonExclusive(page))); + VM_BUG_ON_FOLIO(pte_write(pte) && (!folio_test_anon(folio) && + PageAnonExclusive(page)), folio); /* * No need to take a page reference as one was already * created when the swap entry was made. */ - if (PageAnon(page)) - page_add_anon_rmap(page, vma, address, RMAP_NONE); + if (folio_test_anon(folio)) + folio_add_anon_rmap_pte(folio, page, vma, address, RMAP_NONE); else /* * Currently device exclusive access only supports anonymous @@ -4075,7 +4077,8 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) folio_add_new_anon_rmap(folio, vma, vmf->address); folio_add_lru_vma(folio, vma); } else { - page_add_anon_rmap(page, vma, vmf->address, rmap_flags); + folio_add_anon_rmap_pte(folio, page, vma, vmf->address, + rmap_flags); } VM_BUG_ON(!folio_test_anon(folio) ||
Let's convert restore_exclusive_pte() and do_swap_page(). While at it, perform some folio conversion in restore_exclusive_pte(). Signed-off-by: David Hildenbrand <david@redhat.com> --- mm/memory.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)