Message ID | 20231211155652.131054-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 F3395C4167B for <linux-mm@archiver.kernel.org>; Mon, 11 Dec 2023 15:58:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 03B106B011F; Mon, 11 Dec 2023 10:57:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F2CC36B0120; Mon, 11 Dec 2023 10:57:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA82E6B0121; Mon, 11 Dec 2023 10:57:55 -0500 (EST) 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 C7B816B011F for <linux-mm@kvack.org>; Mon, 11 Dec 2023 10:57:55 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id ADCFE1A077A for <linux-mm@kvack.org>; Mon, 11 Dec 2023 15:57:55 +0000 (UTC) X-FDA: 81554993310.14.7BA7084 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf25.hostedemail.com (Postfix) with ESMTP id D9856A0027 for <linux-mm@kvack.org>; Mon, 11 Dec 2023 15:57:53 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CMHusMLW; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.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=1702310274; a=rsa-sha256; cv=none; b=8jAlMXM1epXDvpvRem2HAL/tD1SmpMJhZ+3Ma1eGUSzjECLUbgEoRWcC0Bf+48TR2Jqwrs TYRNGWyPwB7ZXaLTy4e0ohST5zbuoyxREUH4ew6EmKhcr2hlbUzA/PDNLhjEhhZYvuzWa5 lg8kVidzDipX2tw2Yurvj9EFya2JUhQ= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CMHusMLW; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.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=1702310274; 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=ErbCAGluk3VXsqVDEiyD10ub89UxQEpB3+XojBc5SDY=; b=mcFi6GtxzodoylU2wDb9uBEXMOMFY9gd4tl1D0K9DQPJFAIuRXmftP1hIcL/3kxGoTrYMs FGNSLCMqrbM6Ik44+NJW9ey3hW4S+tiCpNLOTVIAQl260qYZVl0oTV4OgQ7L67Uf/OP2wd hC78NMPYP8axzVroIMytz6KH1lMOR4Q= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702310273; 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=ErbCAGluk3VXsqVDEiyD10ub89UxQEpB3+XojBc5SDY=; b=CMHusMLW3UDXs2qo5zgCdH4m6KCKMr3eejdr2bslvcApqNQk6Q1Z8LXi35rDKnn+eHMLfX Eqh520jsdj9HWNZjnBFwyuKKxYNihMmOee2oBMU8UU8MTvkw/nkwyacER/oAqSFufnIMRd s4a6yFci/8fB3xURlQu0/lcxZC7zZOM= 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-690-mgQppAEyP5iFD7nuwA5GFg-1; Mon, 11 Dec 2023 10:57:47 -0500 X-MC-Unique: mgQppAEyP5iFD7nuwA5GFg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 57849870831; Mon, 11 Dec 2023 15:57:47 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2D511121306; Mon, 11 Dec 2023 15:57:44 +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 v1 20/39] mm/memory: page_add_anon_rmap() -> folio_add_anon_rmap_pte() Date: Mon, 11 Dec 2023 16:56:33 +0100 Message-ID: <20231211155652.131054-21-david@redhat.com> In-Reply-To: <20231211155652.131054-1-david@redhat.com> References: <20231211155652.131054-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Rspam-User: X-Rspamd-Server: rspam06 X-R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usGOtrZSm5P7JB/w652fr9kzR3GPCtHKF8T/kVS1k/bVSsCsNYlQjS+yX+2TgXBIwVPgBf0Gu9J9F5oAtHtv9bc34SUKXaW4d4+2b6FhyNhiI/6Njv2+I+R2mY+9zAZMY1SglJDaOtZr3d5AIJA7DNZi06n/AaJ8gpBBvu+Vg/9lqp8C6ksa5R4YWwQqMCEyLyrfud4npwh0hMl35/liwYMPfA== 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 70754fd65788..97e064883992 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 @@ -4073,7 +4075,8 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) page_add_new_anon_rmap(page, 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(-)