From: Matthew Wilcox <willy@infradead.org>
To: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, x86@kernel.org,
linux-s390@vger.kernel.org, sparclinux@vger.kernel.org,
linux-um@lists.infradead.org
Subject: Re: [PATCH 1/7] mm: Set the pte dirty if the folio is already dirty
Date: Tue, 18 Feb 2025 17:06:38 +0000 [thread overview]
Message-ID: <Z7S-HgdXls65goJx@casper.infradead.org> (raw)
In-Reply-To: <Z7SzTHQGFXreZ6zd@li-008a6a4c-3549-11b2-a85c-c5cc2836eea2.ibm.com>
On Tue, Feb 18, 2025 at 05:20:28PM +0100, Alexander Gordeev wrote:
> > +++ b/arch/s390/include/asm/pgtable.h
> > @@ -1451,12 +1451,7 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
> >
> > static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
> > {
> > - unsigned long physpage = page_to_phys(page);
> > - pte_t __pte = mk_pte_phys(physpage, pgprot);
> > -
> > - if (pte_write(__pte) && PageDirty(page))
> > - __pte = pte_mkdirty(__pte);
> > - return __pte;
> > + return mk_pte_phys(page_to_phys(page), pgprot);
> > }
>
> With the above the implicit dirtifying of hugetlb PTEs (as result of
> mk_huge_pte() -> mk_pte()) in make_huge_pte() is removed:
>
> static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,
> bool try_mkwrite)
> {
> ...
> if (try_mkwrite && (vma->vm_flags & VM_WRITE)) {
> entry = huge_pte_mkwrite(huge_pte_mkdirty(mk_huge_pte(page,
> vma->vm_page_prot)));
> } else {
> entry = huge_pte_wrprotect(mk_huge_pte(page,
> vma->vm_page_prot));
> }
Took me a moment to spot how this was getting invoked; for anyone else
playing along, it's mk_huge_pte() which calls mk_pte().
But I'm not sure how you lose out on the PTE being marked dirty. In
the first arm that you've quoted, the pte is made dirty anyway. In the
second arm, it's being writeprotected, so marking it dirty isn't a
helpful thing to do because writing to it will cause a fault anyway?
I know s390 is a little different, so there's probably something I'm
missing.
next prev parent reply other threads:[~2025-02-18 17:08 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 19:08 [PATCH 0/7] Add folio_mk_pte() and simplify mk_pte() Matthew Wilcox (Oracle)
2025-02-17 19:08 ` [PATCH 1/7] mm: Set the pte dirty if the folio is already dirty Matthew Wilcox (Oracle)
2025-02-18 10:31 ` David Hildenbrand
2025-02-18 16:20 ` Alexander Gordeev
2025-02-18 17:06 ` Matthew Wilcox [this message]
2025-02-19 7:27 ` Alexander Gordeev
2025-02-19 7:33 ` Alexander Gordeev
2025-02-19 8:46 ` Alexander Gordeev
2025-02-17 19:08 ` [PATCH 2/7] mm: Introduce a common definition of mk_pte() Matthew Wilcox (Oracle)
2025-02-18 8:15 ` Geert Uytterhoeven
2025-02-18 10:32 ` David Hildenbrand
2025-02-19 9:07 ` Alexander Gordeev
2025-02-17 19:08 ` [PATCH 3/7] sparc32: Remove custom " Matthew Wilcox (Oracle)
2025-02-17 19:08 ` [PATCH 4/7] x86: " Matthew Wilcox (Oracle)
2025-02-19 20:53 ` Dave Hansen
2025-02-17 19:08 ` [PATCH 5/7] um: " Matthew Wilcox (Oracle)
2025-02-17 19:08 ` [PATCH 6/7] mm: Make mk_pte() definition unconditional Matthew Wilcox (Oracle)
2025-02-18 10:32 ` David Hildenbrand
2025-02-17 19:08 ` [PATCH 7/7] mm: Add folio_mk_pte() Matthew Wilcox (Oracle)
2025-02-18 10:33 ` David Hildenbrand
2025-02-18 10:29 ` [PATCH 0/7] Add folio_mk_pte() and simplify mk_pte() 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=Z7S-HgdXls65goJx@casper.infradead.org \
--to=willy@infradead.org \
--cc=agordeev@linux.ibm.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=sparclinux@vger.kernel.org \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).