From: Peter Xu <peterx@redhat.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Muchun Song <muchun.song@linux.dev>,
"x86@kernel.org" <x86@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Matthew Wilcox <willy@infradead.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Mike Rapoport <rppt@kernel.org>, Jason Gunthorpe <jgg@nvidia.com>,
"sparclinux@vger.kernel.org" <sparclinux@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 12/13] mm/treewide: Remove pXd_huge()
Date: Thu, 14 Mar 2024 10:08:50 -0400 [thread overview]
Message-ID: <ZfME8vjFhl8AdyFe@x1n> (raw)
In-Reply-To: <7e93ab99-c956-42d0-9afd-3c856f3ad951@csgroup.eu>
On Thu, Mar 14, 2024 at 08:56:59AM +0000, Christophe Leroy wrote:
>
>
> Le 13/03/2024 à 22:47, peterx@redhat.com a écrit :
> > From: Peter Xu <peterx@redhat.com>
> >
> > This API is not used anymore, drop it for the whole tree.
> >
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > arch/arm/mm/Makefile | 1 -
> > arch/arm/mm/hugetlbpage.c | 29 -------------------
> > arch/arm64/mm/hugetlbpage.c | 10 -------
> > arch/loongarch/mm/hugetlbpage.c | 10 -------
> > arch/mips/include/asm/pgtable-32.h | 2 +-
> > arch/mips/include/asm/pgtable-64.h | 2 +-
> > arch/mips/mm/hugetlbpage.c | 10 -------
> > arch/parisc/mm/hugetlbpage.c | 11 -------
> > .../include/asm/book3s/64/pgtable-4k.h | 10 -------
> > .../include/asm/book3s/64/pgtable-64k.h | 25 ----------------
> > arch/powerpc/include/asm/nohash/pgtable.h | 10 -------
> > arch/riscv/mm/hugetlbpage.c | 10 -------
> > arch/s390/mm/hugetlbpage.c | 10 -------
> > arch/sh/mm/hugetlbpage.c | 10 -------
> > arch/sparc/mm/hugetlbpage.c | 10 -------
> > arch/x86/mm/hugetlbpage.c | 16 ----------
> > include/linux/hugetlb.h | 24 ---------------
> > 17 files changed, 2 insertions(+), 198 deletions(-)
> > delete mode 100644 arch/arm/mm/hugetlbpage.c
> >
>
> > diff --git a/arch/mips/include/asm/pgtable-32.h b/arch/mips/include/asm/pgtable-32.h
> > index 0e196650f4f4..92b7591aac2a 100644
> > --- a/arch/mips/include/asm/pgtable-32.h
> > +++ b/arch/mips/include/asm/pgtable-32.h
> > @@ -129,7 +129,7 @@ static inline int pmd_none(pmd_t pmd)
> > static inline int pmd_bad(pmd_t pmd)
> > {
> > #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
> > - /* pmd_huge(pmd) but inline */
> > + /* pmd_leaf(pmd) but inline */
>
> Shouldn't this comment have been changed in patch 11 ?
IMHO it's fine to be here, as this is the patch to finally drop _huge().
Patch 11 only converts the callers to use _leaf()s. So this comment is
still valid until this patch, because this patch removes that definition.
>
> > if (unlikely(pmd_val(pmd) & _PAGE_HUGE))
>
> Unlike pmd_huge() which is an outline function, pmd_leaf() is a macro so
> it could be used here instead of open coping.
I worry it will break things as pmd_leaf() can sometimes be defined after
arch *pgtable.h headers. So I avoided touching it except what I think I'm
confident. I had a feeling it's inlined just because of a similar reason
for the old _huge().
>
> > return 0;
> > #endif
> > diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
> > index 20ca48c1b606..7c28510b3768 100644
> > --- a/arch/mips/include/asm/pgtable-64.h
> > +++ b/arch/mips/include/asm/pgtable-64.h
> > @@ -245,7 +245,7 @@ static inline int pmd_none(pmd_t pmd)
> > static inline int pmd_bad(pmd_t pmd)
> > {
> > #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
> > - /* pmd_huge(pmd) but inline */
> > + /* pmd_leaf(pmd) but inline */
>
> Same
>
> > if (unlikely(pmd_val(pmd) & _PAGE_HUGE))
>
> Same
>
> > return 0;
> > #endif
>
> > diff --git a/arch/powerpc/include/asm/book3s/64/pgtable-64k.h b/arch/powerpc/include/asm/book3s/64/pgtable-64k.h
> > index 2fce3498b000..579a7153857f 100644
> > --- a/arch/powerpc/include/asm/book3s/64/pgtable-64k.h
> > +++ b/arch/powerpc/include/asm/book3s/64/pgtable-64k.h
> > @@ -4,31 +4,6 @@
> >
> > #ifndef __ASSEMBLY__
> > #ifdef CONFIG_HUGETLB_PAGE
> > -/*
> > - * We have PGD_INDEX_SIZ = 12 and PTE_INDEX_SIZE = 8, so that we can have
> > - * 16GB hugepage pte in PGD and 16MB hugepage pte at PMD;
> > - *
> > - * Defined in such a way that we can optimize away code block at build time
> > - * if CONFIG_HUGETLB_PAGE=n.
> > - *
> > - * returns true for pmd migration entries, THP, devmap, hugetlb
> > - * But compile time dependent on CONFIG_HUGETLB_PAGE
> > - */
>
> Should we keep this comment somewhere for documentation ?
The 2nd/3rd paragraphs are definitely obsolete, so should be dropped.
OTOH, I'm not sure how much that will help if e.g. I move that over to
pmd_leaf(): a check over cpu_to_be64(_PAGE_PTE) is an implementation as
simple as it could be to explain itself with even no comment to me..
I also don't fully digest why that 1st paragraph discusses PGD entries: for
example, there's no pgd_huge() defined. It may not mean that the comment
is wrong, perhaps it means that I may lack some knowledge around this area
on Power..
Would you suggest how I should move paragraph 1 (and help to explain what
it is describing)? Or maybe we can provide a separate patch for Power's
huge page sizes but posted separately (and very possibly I'm not the best
candidate then..).
>
> > -static inline int pmd_huge(pmd_t pmd)
> > -{
> > - /*
> > - * leaf pte for huge page
> > - */
> > - return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE));
> > -}
> > -
> > -static inline int pud_huge(pud_t pud)
> > -{
> > - /*
> > - * leaf pte for huge page
> > - */
> > - return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PTE));
> > -}
> >
> > /*
> > * With 64k page size, we have hugepage ptes in the pgd and pmd entries. We don't
--
Peter Xu
next prev parent reply other threads:[~2024-03-14 14:09 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-13 21:47 [PATCH 00/13] mm/treewide: Remove pXd_huge() API peterx
2024-03-13 21:47 ` [PATCH 01/13] mm/hmm: Process pud swap entry without pud_huge() peterx
2024-03-13 21:47 ` [PATCH 02/13] mm/gup: Cache p4d in follow_p4d_mask() peterx
2024-03-13 21:47 ` [PATCH 03/13] mm/gup: Check p4d presence before going on peterx
2024-03-13 21:47 ` [PATCH 04/13] mm/x86: Change pXd_huge() behavior to exclude swap entries peterx
2024-03-13 21:47 ` [PATCH 05/13] mm/sparc: " peterx
2024-03-13 21:47 ` [PATCH 06/13] mm/arm: Use macros to define pmd/pud helpers peterx
2024-03-13 21:47 ` [PATCH 07/13] mm/arm: Redefine pmd_huge() with pmd_leaf() peterx
2024-03-13 21:47 ` [PATCH 08/13] mm/arm64: Merge pXd_huge() and pXd_leaf() definitions peterx
2024-03-13 21:47 ` [PATCH 09/13] mm/powerpc: Redefine pXd_huge() with pXd_leaf() peterx
2024-03-14 8:45 ` Christophe Leroy
2024-03-14 12:53 ` Peter Xu
2024-03-14 13:11 ` Christophe Leroy
2024-03-18 16:15 ` Jason Gunthorpe
2024-03-19 23:07 ` Christophe Leroy
2024-03-19 23:26 ` Jason Gunthorpe
2024-03-20 6:16 ` Christophe Leroy
2024-03-20 16:09 ` Peter Xu
2024-03-20 17:40 ` Christophe Leroy
2024-03-20 20:24 ` Peter Xu
2024-03-13 21:47 ` [PATCH 10/13] mm/gup: Merge pXd huge mapping checks peterx
2024-03-13 21:47 ` [PATCH 11/13] mm/treewide: Replace pXd_huge() with pXd_leaf() peterx
2024-03-14 8:50 ` Christophe Leroy
2024-03-14 12:59 ` Peter Xu
2024-03-18 16:16 ` Jason Gunthorpe
2024-03-13 21:47 ` [PATCH 12/13] mm/treewide: Remove pXd_huge() peterx
2024-03-14 8:56 ` Christophe Leroy
2024-03-14 14:08 ` Peter Xu [this message]
2024-03-13 21:47 ` [PATCH 13/13] mm: Document pXd_leaf() API peterx
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=ZfME8vjFhl8AdyFe@x1n \
--to=peterx@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=christophe.leroy@csgroup.eu \
--cc=jgg@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=muchun.song@linux.dev \
--cc=rppt@kernel.org \
--cc=sparclinux@vger.kernel.org \
--cc=willy@infradead.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).