[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zlb_XT12arHu9vu3@localhost.localdomain>
Date: Wed, 29 May 2024 12:11:41 +0200
From: Oscar Salvador <osalvador@...e.com>
To: Christophe Leroy <christophe.leroy@...roup.eu>
Cc: Oscar Salvador <osalvador@...e.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Jason Gunthorpe <jgg@...dia.com>, Peter Xu <peterx@...hat.com>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [RFC PATCH v4 14/16] powerpc/64s: Use contiguous PMD/PUD instead
of HUGEPD
On Wed, May 29, 2024 at 10:07:55AM +0000, Christophe Leroy wrote:
> We can't but I didn't want to leave nb undefined or with a value that
> might lead to writing in the weed. Value 1 seems a safe default.
Might be worth to throw a WARN_ON?
> >> diff --git a/arch/powerpc/mm/book3s64/hugetlbpage.c b/arch/powerpc/mm/book3s64/hugetlbpage.c
> >> index 5a2e512e96db..83c3361b358b 100644
> >> --- a/arch/powerpc/mm/book3s64/hugetlbpage.c
> >> +++ b/arch/powerpc/mm/book3s64/hugetlbpage.c
> >> @@ -53,6 +53,16 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
> >> /* If PTE permissions don't match, take page fault */
> >> if (unlikely(!check_pte_access(access, old_pte)))
> >> return 1;
> >> + /*
> >> + * If hash-4k, hugepages use seeral contiguous PxD entries
> > 'several'
> >> + * so bail out and let mm make the page young or dirty
> >> + */
> >> + if (IS_ENABLED(CONFIG_PPC_4K_PAGES)) {
> >> + if (!(old_pte & _PAGE_ACCESSED))
> >> + return 1;
> >> + if ((access & _PAGE_WRITE) && !(old_pte & _PAGE_DIRTY))
> >> + return 1;
> >
> > I have 0 clue about this code. What would happen if we do not bail out?
> >
>
> In that case the pte_xchg() in the while () will only set ACCESS or
> DIRTY bit on the first PxD entry, not on all cont-PxD entries.
I see, thanks for explaining.
--
Oscar Salvador
SUSE Labs
Powered by blists - more mailing lists