From patchwork Mon Feb 10 19:37:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13968591 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 D15E5C021A1 for ; Mon, 10 Feb 2025 19:38:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 626A428000D; Mon, 10 Feb 2025 14:38:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5AEB328000B; Mon, 10 Feb 2025 14:38:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 400B428000D; Mon, 10 Feb 2025 14:38:52 -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 1E7BE28000B for ; Mon, 10 Feb 2025 14:38:52 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B11B01204A8 for ; Mon, 10 Feb 2025 19:38:51 +0000 (UTC) X-FDA: 83105047662.06.3371B8D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf06.hostedemail.com (Postfix) with ESMTP id 6BA9E180012 for ; Mon, 10 Feb 2025 19:38:49 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Er3L2kI6; spf=pass (imf06.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhildenb@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1739216329; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QxHe6mgzr5LViG+7+kvBnycnKkPt1kZTw9hZ/c9dl+o=; b=OQRX0H5eWDg0hAjG3o88k4b7E92SIEYESSVsh1Q1aAiwBRkq1+fbJTWRbbrXEKOoNBMQVS U9h2ToHew15zBbQbFpU8gV5nHglpskQ/dqPh6U75EzQcSVjM53CIaGRcZZJ8GZJ3FotPAO OWPvI9r8R1eO0HumnUnte5AXa3iXkyA= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Er3L2kI6; spf=pass (imf06.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhildenb@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1739216329; a=rsa-sha256; cv=none; b=JpZ1aeCGXoy4i4JRmpLwVjij6Yy+FfYsXnpFAS0FpdwPOVP5exQ2kUlJnYX2RzE5Fmb7v3 TLgZZon24fPfHyJrmZpzms/I3ysh1ysBewi1mweeenr23/XN5gxuysVDmu/tswvKKpJAGG HLVn/BZHpr5AR3ZAJii0M5XNtFpRIF4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1739216328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QxHe6mgzr5LViG+7+kvBnycnKkPt1kZTw9hZ/c9dl+o=; b=Er3L2kI6LbrBA74nW9z4h8Uqh9EhvS2+IJI6ini5gmcM0qMywBFHmic2B5uHSeAOXkLx+y qSfnlYhT1mwgjQRaNvW1tOQrVWo3J0gbgcbdlLYDPsYwBlOeVUpaBwHphxjzNBaxiFDXJS CJ+hRfSt8DUZ+qvv9wqvgQ0t79pBoC0= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-107-r8Xi-7WkMWO_jjg1xquNDw-1; Mon, 10 Feb 2025 14:38:47 -0500 X-MC-Unique: r8Xi-7WkMWO_jjg1xquNDw-1 X-Mimecast-MFC-AGG-ID: r8Xi-7WkMWO_jjg1xquNDw Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-43626224274so28059405e9.0 for ; Mon, 10 Feb 2025 11:38:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739216326; x=1739821126; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QxHe6mgzr5LViG+7+kvBnycnKkPt1kZTw9hZ/c9dl+o=; b=MS8BYM8Af++UAxQd5jdGE8rZ5AjkNCWtN2Wmg4Z3qvkjDzJ9frquQTi9BAvrfqLZI/ 38P8t10k+Bh6VRbQMSemO0zHuTJSrE8TJ7vVpsk6jztdhbN8HUX3HiNMk2K7jK/XRi4X N2cDyaXPFnGIXynElClSo5z4e34I7v5L6B8mn0VrGBATiGHvsczywft4UVSVXGAP55qF AhXHu5qT1PqTnj+t8T0tS+qEgpVKWK47iZnJyl0y7KLRVXwyVqFsQ2jcjufvwdbXmOIv Fm7FjyEB2NzQPwfHqyITh/EzAFEQJ6ZDSTUYA6f1pkO4oyXF7vox71rftMANcgpPjQlw bCpA== X-Forwarded-Encrypted: i=1; AJvYcCWyR8ykqk7oK8Wix+LCGTyi9EF+5U49fukd2nOfHb3+6rPGtY3YzRnjHDwACM+Viyw64G/4wtRJmA==@kvack.org X-Gm-Message-State: AOJu0YzHCtG9LNlL30Y00QfJsjK0p1vj6obae/VrWU5af29n890ArQIs wl8Of2L8aoBqArmXXiO4JVzUS9lQDKATdI3bRXcEUXeNdH8uMST0INfdWQMYpcVPyBI8lWAwj8x 1xs2C6JPLl76hUcsWUMMYRP9eDBf49PaThrsLw1Qozdq5vJ2E X-Gm-Gg: ASbGncuMcqutc3vhcsNonIH1fm8bogwfbmYvbd/dmOsixMrysnh3VZR0SaFNEJoVSad 3N7hDQsoUm0F9rfnFEHdsfbtvsZg2cZ9FVnrovMxZ5OxIslCTschaA7NrbtZ4uBDBqU4sCjzdJz TkC3gMHlmhl5LBK3LLy2bS/AM1USMlnbWisWwXlOnSPXc0AEjQLnNdp2HGk0zID25NECif2NbzI 7EVOAU/k9KZ0so2xxuk0Br57afB5eS/utM6cC+C6fmsGBZZC34ipw7zP9XKwp9D3WeK/6VDsK0g 6ZV5aaWL4d3Y73+jvt8whOrUSuU179gYEkfpURynIwHF962salXWPmJ9I4oaKL4tLg== X-Received: by 2002:a05:6000:2a6:b0:38d:dc4d:3473 with SMTP id ffacd0b85a97d-38ddc4d34b0mr6018880f8f.51.1739216326372; Mon, 10 Feb 2025 11:38:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEI9wcsziW5nBYTCF/f9iYx8hWmPInDi/J4NMO1Qty0GFsip5PSFKOaGK1UrWp2GzbjhG1/jA== X-Received: by 2002:a05:6000:2a6:b0:38d:dc4d:3473 with SMTP id ffacd0b85a97d-38ddc4d34b0mr6018834f8f.51.1739216325915; Mon, 10 Feb 2025 11:38:45 -0800 (PST) Received: from localhost (p200300cbc734b80012c465cd348aaee6.dip0.t-ipconnect.de. [2003:cb:c734:b800:12c4:65cd:348a:aee6]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-38dd295200asm7894656f8f.44.2025.02.10.11.38.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Feb 2025 11:38:44 -0800 (PST) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org, nouveau@lists.freedesktop.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, damon@lists.linux.dev, David Hildenbrand , Andrew Morton , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Jonathan Corbet , Alex Shi , Yanteng Si , Karol Herbst , Lyude Paul , Danilo Krummrich , David Airlie , Simona Vetter , Masami Hiramatsu , Oleg Nesterov , Peter Zijlstra , SeongJae Park , "Liam R. Howlett" , Lorenzo Stoakes , Vlastimil Babka , Jann Horn , Pasha Tatashin , Peter Xu , Alistair Popple , Jason Gunthorpe Subject: [PATCH v2 11/17] mm/rmap: handle device-exclusive entries correctly in try_to_migrate_one() Date: Mon, 10 Feb 2025 20:37:53 +0100 Message-ID: <20250210193801.781278-12-david@redhat.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250210193801.781278-1-david@redhat.com> References: <20250210193801.781278-1-david@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: lw2nkDjxMXE5x73T4g7zbtha3QrKXJyzh8u0b9GsCHU_1739216326 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 6BA9E180012 X-Stat-Signature: a3cpukuqwaifwjegj3xy5y3nfxuhuyiy X-Rspam-User: X-HE-Tag: 1739216329-293861 X-HE-Meta: U2FsdGVkX19faexw9HQ4pFHaqliHVqrT7B84bC9gXfuWHU0MB4pyR8yXrZaSXznDrcZuTdIkl9OMQO+r8N/huJOAZOmkueQi5A1ecSt7PPoYd/W1Dm5rqQOo9qhADEtCcXf3/VbpqO3cEkE/c+9vyVFvlQ5TTM8ZNicubXjFYz+gSIzW6mKs5rJRwGdTqjhhkGNeHrJWsCJ2WplKWgt/1v4nPNw3rhx5HuV98F3Rv/Ae+hbUYYTFFx1QA6WNd7kw0bL33DQ9bKLEuZ3BB98k0N/r6O/m8qbzygCsxPEQxN43hjoI1uGiRZNHqWLCY6NhcaEkb2zYnd6no9HAyJY4E9GjzND2U7DCYidt0f7hzYQHqIWJqxZ7pJWsCxXvnz+jEOg6RWUP+f1726usr861K1V5VVJ2XRg2ElxZjE6ocjbE54gG7KeysKhVlepU9O16e5BdqvhC//uKr7DuYGRUaGsyuzykH3RcU1gC0WWEi9GBtPxuW55u/MN2/42VPlxJh1gUK4RvLdVP7hOiHR03BPumvKGiAdIv/EVAPes9hAjZr+9kOjwlbwzAbZFRwnH1d5k3qgEdaZDluWl2ywDHpeX4jKgBxhmFyjZDSYmcZR7DmIYwcCKCqGkHEBh0mLPmivoRMhv12Jw9CLLMB4ZPzq0nQIDH/zSnDAQF3ZonLhLfEmWvOHUNczcyozm9m2jQ0IIj1nDiBVjCyx/hdD59ZwSXX/YXm/FKyUa+tKzK01QtQN/jEoGODojm++Bu7odn019Kp6dnjSVCK5XU2bfTMnCSp2l8Y4hxHYY+UrEz/Eqc4+fCeUGBtJofJJdYSxqKsfdic1yrj++DNU8cIrMlMuXrIDCaT2m0aVBZovANESXtKK2gM6qJzr2UjNJ7sXfTPocqpV6AL0Ek5/1hXcCKA6wszw0z0hN5fgVr2sDzP+2znWylmwjNnCf1Arz0NknWP7yq8fB3PEUyEBCQNC9 cz9b87bw aCMAVIklStdcYGKJK7OHqI/JgLOIiUxYkBl0V7DKDWqgB5NrplDmtdH1KeAKLdMyaDvpVh4Hm36uCTtC/nYFkhGDHtMCRymLlZbL/XDIMaBVyJsNd1KjhIFvy6P+3knnJylll5GgqzSF2dVPFtoza5AVm4D8uu3/MEYWh8+XeMIJz7OuZP/rmeiFviW7eiQnLbjGJuvyPE0zTZOrZoCbaIH3xKitGFgH2WyOBZ4xNxWNZYiGOI6H+6YZVjbyNhI05Rdu0Skrp983TVSFJgoNqFF/evZdjygKm7JgLuhhEURi9X0nM4hcmPRFoRuBvlkQRC+l745y08BNO6edNkLkPRPyIjse7hKiusvx9JMyROy6ZMkomcZ8dbq/Os5L9gQkktohC3WXqlBxb3tXkFPshA/EI7q+Y+uXni13Mi9mLYGB8/37CANT8bQwZb3eT7KEWcmiW8KGqF+LUdtu3PVQtIlVkV8DwXDqGDXu7LOfz038lkAA3MJdYifTyTZgKoZsShcuX0onVXaYJADfXD/G0snk62Q== 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: Ever since commit b756a3b5e7ea ("mm: device exclusive memory access") we can return with a device-exclusive entry from page_vma_mapped_walk(). try_to_migrate_one() is not prepared for that, so teach it about these PFN swap PTEs. We already handle device-private entries by specializing on the folio, so we can reshuffle that code to make it work on the PFN swap PTEs instead. Get rid of the folio_is_device_private() handling. Note that we never currently expect device-private folios with HWPoison flag set at that point, so add a warning in case that ever changes and we can figure out what the right thing to do is. Note that we could currently only run into this case with device-exclusive entries on THPs. We still adjust the mapcount on conversion to device-exclusive; this makes the rmap walk abort early for small folios, because we'll always have !folio_mapped() with a single device-exclusive entry. We'll adjust the mapcount logic once all page_vma_mapped_walk() users can properly handle device-exclusive entries. Further note that try_to_migrate() calls MMU notifiers and holds the folio lock, so any device-exclusive users should be properly prepared for a device-exclusive PTE to "vanish". Fixes: b756a3b5e7ea ("mm: device exclusive memory access") Signed-off-by: David Hildenbrand --- mm/rmap.c | 124 ++++++++++++++++++++++-------------------------------- 1 file changed, 51 insertions(+), 73 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index 47142a656ae51..7c471c3ea64c4 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -2039,9 +2039,9 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, { struct mm_struct *mm = vma->vm_mm; DEFINE_FOLIO_VMA_WALK(pvmw, folio, vma, address, 0); + bool anon_exclusive, writable, ret = true; pte_t pteval; struct page *subpage; - bool anon_exclusive, ret = true; struct mmu_notifier_range range; enum ttu_flags flags = (enum ttu_flags)(long)arg; unsigned long pfn; @@ -2108,24 +2108,19 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, /* Unexpected PMD-mapped THP? */ VM_BUG_ON_FOLIO(!pvmw.pte, folio); - pfn = pte_pfn(ptep_get(pvmw.pte)); - - if (folio_is_zone_device(folio)) { - /* - * Our PTE is a non-present device exclusive entry and - * calculating the subpage as for the common case would - * result in an invalid pointer. - * - * Since only PAGE_SIZE pages can currently be - * migrated, just set it to page. This will need to be - * changed when hugepage migrations to device private - * memory are supported. - */ - VM_BUG_ON_FOLIO(folio_nr_pages(folio) > 1, folio); - subpage = &folio->page; + /* + * Handle PFN swap PTEs, such as device-exclusive ones, that + * actually map pages. + */ + pteval = ptep_get(pvmw.pte); + if (likely(pte_present(pteval))) { + pfn = pte_pfn(pteval); } else { - subpage = folio_page(folio, pfn - folio_pfn(folio)); + pfn = swp_offset_pfn(pte_to_swp_entry(pteval)); + VM_WARN_ON_FOLIO(folio_test_hugetlb(folio), folio); } + + subpage = folio_page(folio, pfn - folio_pfn(folio)); address = pvmw.address; anon_exclusive = folio_test_anon(folio) && PageAnonExclusive(subpage); @@ -2181,7 +2176,10 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, } /* Nuke the hugetlb page table entry */ pteval = huge_ptep_clear_flush(vma, address, pvmw.pte); - } else { + if (pte_dirty(pteval)) + folio_mark_dirty(folio); + writable = pte_write(pteval); + } else if (likely(pte_present(pteval))) { flush_cache_page(vma, address, pfn); /* Nuke the page table entry. */ if (should_defer_flush(mm, flags)) { @@ -2199,54 +2197,23 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, } else { pteval = ptep_clear_flush(vma, address, pvmw.pte); } + if (pte_dirty(pteval)) + folio_mark_dirty(folio); + writable = pte_write(pteval); + } else { + pte_clear(mm, address, pvmw.pte); + writable = is_writable_device_private_entry(pte_to_swp_entry(pteval)); } - /* Set the dirty flag on the folio now the pte is gone. */ - if (pte_dirty(pteval)) - folio_mark_dirty(folio); + VM_WARN_ON_FOLIO(writable && folio_test_anon(folio) && + !anon_exclusive, folio); /* Update high watermark before we lower rss */ update_hiwater_rss(mm); - if (folio_is_device_private(folio)) { - unsigned long pfn = folio_pfn(folio); - swp_entry_t entry; - pte_t swp_pte; - - if (anon_exclusive) - WARN_ON_ONCE(folio_try_share_anon_rmap_pte(folio, - subpage)); + if (PageHWPoison(subpage)) { + VM_WARN_ON_FOLIO(folio_is_device_private(folio), folio); - /* - * Store the pfn of the page in a special migration - * pte. do_swap_page() will wait until the migration - * pte is removed and then restart fault handling. - */ - entry = pte_to_swp_entry(pteval); - if (is_writable_device_private_entry(entry)) - entry = make_writable_migration_entry(pfn); - else if (anon_exclusive) - entry = make_readable_exclusive_migration_entry(pfn); - else - entry = make_readable_migration_entry(pfn); - swp_pte = swp_entry_to_pte(entry); - - /* - * pteval maps a zone device page and is therefore - * a swap pte. - */ - if (pte_swp_soft_dirty(pteval)) - swp_pte = pte_swp_mksoft_dirty(swp_pte); - if (pte_swp_uffd_wp(pteval)) - swp_pte = pte_swp_mkuffd_wp(swp_pte); - set_pte_at(mm, pvmw.address, pvmw.pte, swp_pte); - trace_set_migration_pte(pvmw.address, pte_val(swp_pte), - folio_order(folio)); - /* - * No need to invalidate here it will synchronize on - * against the special swap migration pte. - */ - } else if (PageHWPoison(subpage)) { pteval = swp_entry_to_pte(make_hwpoison_entry(subpage)); if (folio_test_hugetlb(folio)) { hugetlb_count_sub(folio_nr_pages(folio), mm); @@ -2256,8 +2223,8 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, dec_mm_counter(mm, mm_counter(folio)); set_pte_at(mm, address, pvmw.pte, pteval); } - - } else if (pte_unused(pteval) && !userfaultfd_armed(vma)) { + } else if (likely(pte_present(pteval)) && pte_unused(pteval) && + !userfaultfd_armed(vma)) { /* * The guest indicated that the page content is of no * interest anymore. Simply discard the pte, vmscan @@ -2273,6 +2240,11 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, swp_entry_t entry; pte_t swp_pte; + /* + * arch_unmap_one() is expected to be a NOP on + * architectures where we could have PFN swap PTEs, + * so we'll not check/care. + */ if (arch_unmap_one(mm, vma, address, pteval) < 0) { if (folio_test_hugetlb(folio)) set_huge_pte_at(mm, address, pvmw.pte, @@ -2283,8 +2255,6 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, page_vma_mapped_walk_done(&pvmw); break; } - VM_BUG_ON_PAGE(pte_write(pteval) && folio_test_anon(folio) && - !anon_exclusive, subpage); /* See folio_try_share_anon_rmap_pte(): clear PTE first. */ if (folio_test_hugetlb(folio)) { @@ -2309,7 +2279,7 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, * pte. do_swap_page() will wait until the migration * pte is removed and then restart fault handling. */ - if (pte_write(pteval)) + if (writable) entry = make_writable_migration_entry( page_to_pfn(subpage)); else if (anon_exclusive) @@ -2318,15 +2288,23 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, else entry = make_readable_migration_entry( page_to_pfn(subpage)); - if (pte_young(pteval)) - entry = make_migration_entry_young(entry); - if (pte_dirty(pteval)) - entry = make_migration_entry_dirty(entry); - swp_pte = swp_entry_to_pte(entry); - if (pte_soft_dirty(pteval)) - swp_pte = pte_swp_mksoft_dirty(swp_pte); - if (pte_uffd_wp(pteval)) - swp_pte = pte_swp_mkuffd_wp(swp_pte); + if (likely(pte_present(pteval))) { + if (pte_young(pteval)) + entry = make_migration_entry_young(entry); + if (pte_dirty(pteval)) + entry = make_migration_entry_dirty(entry); + swp_pte = swp_entry_to_pte(entry); + if (pte_soft_dirty(pteval)) + swp_pte = pte_swp_mksoft_dirty(swp_pte); + if (pte_uffd_wp(pteval)) + swp_pte = pte_swp_mkuffd_wp(swp_pte); + } else { + swp_pte = swp_entry_to_pte(entry); + if (pte_swp_soft_dirty(pteval)) + swp_pte = pte_swp_mksoft_dirty(swp_pte); + if (pte_swp_uffd_wp(pteval)) + swp_pte = pte_swp_mkuffd_wp(swp_pte); + } if (folio_test_hugetlb(folio)) set_huge_pte_at(mm, address, pvmw.pte, swp_pte, hsz);