public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
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>,
	"Jérôme Glisse" <jglisse@redhat.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Alistair Popple" <apopple@nvidia.com>,
	"Jason Gunthorpe" <jgg@nvidia.com>
Subject: [PATCH v2 2/5] mm/memory: remove PageAnonExclusive sanity-check in restore_exclusive_pte()
Date: Wed, 26 Feb 2025 14:22:54 +0100	[thread overview]
Message-ID: <20250226132257.2826043-3-david@redhat.com> (raw)
In-Reply-To: <20250226132257.2826043-1-david@redhat.com>

In commit b832a354d787 ("mm/memory: page_add_anon_rmap() ->
folio_add_anon_rmap_pte()") we accidentally changed the sanity check to
essentially ignore anonymous folio by mis-placing the "!" ... but we really
always only get anonymous folios in restore_exclusive_pte().

However, in the meantime we removed the separate "writable
device-exclusive entries" and always detect if the PTE can be writable
using can_change_pte_writable() -- which also consults
PageAnonExclusive.

So let's just get rid of this sanity check completely.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 mm/memory.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 567b45e5d149e..507045fa719cc 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -740,9 +740,6 @@ static void restore_exclusive_pte(struct vm_area_struct *vma,
 			pte = pte_mkdirty(pte);
 		pte = pte_mkwrite(pte, vma);
 	}
-
-	VM_BUG_ON_FOLIO(pte_write(pte) && (!folio_test_anon(folio) &&
-					   PageAnonExclusive(page)), folio);
 	set_pte_at(vma->vm_mm, address, ptep, pte);
 
 	/*
-- 
2.48.1



  parent reply	other threads:[~2025-02-26 13:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 13:22 [PATCH v2 0/5] mm: cleanups for device-exclusive entries (hmm) David Hildenbrand
2025-02-26 13:22 ` [PATCH v2 1/5] lib/test_hmm: make dmirror_atomic_map() consume a single page David Hildenbrand
2025-02-26 13:22 ` David Hildenbrand [this message]
2025-02-26 13:22 ` [PATCH v2 3/5] mm/memory: pass folio and pte to restore_exclusive_pte() David Hildenbrand
2025-02-26 13:22 ` [PATCH v2 4/5] mm/memory: document restore_exclusive_pte() David Hildenbrand
2025-02-26 13:22 ` [PATCH v2 5/5] mm/mmu_notifier: use MMU_NOTIFY_CLEAR in remove_device_exclusive_entry() David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250226132257.2826043-3-david@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=jgg@nvidia.com \
    --cc=jglisse@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=simona@ffwll.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox