mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
To: Barry Song <baohua@kernel.org>
Cc: Wen Jiang <jiangwenxiaomi@gmail.com>,
	akpm@linux-foundation.org, catalin.marinas@arm.com,
	linux-mm@kvack.org, urezki@gmail.com, will@kernel.org,
	Xueyuan.chen21@gmail.com, ajd@linux.ibm.com,
	anshuman.khandual@arm.com, david@kernel.org, dev.jain@arm.com,
	jiangwen6@xiaomi.com, leo.yan@arm.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
	rppt@kernel.org, ryan.roberts@arm.com
Subject: Re: [PATCH v8 02/10] powerpc/8xx: add pte_set_huge()
Date: Fri, 18 Sep 2026 11:11:04 +0200	[thread overview]
Message-ID: <930f3db4-9034-4a48-98b2-07a44de3a718@kernel.org> (raw)
In-Reply-To: <CAGsJ_4wKG91hd1Y3W4mbdh6B8Kq09JyDjyvXeeCmQj+L6bHm2A@mail.gmail.com>



Le 18/09/2026 à 10:44, Barry Song a écrit :
> On Fri, Sep 18, 2026 at 2:14 PM Christophe Leroy (CS GROUP)
> <chleroy@kernel.org> wrote:
>>
>>
>>
>> Le 17/09/2026 à 07:29, Wen Jiang a écrit :
>>> From: Wen Jiang <jiangwen6@xiaomi.com>
>>>
>>> vmap installs PTE-level block mappings (SZ_16K/SZ_512K on powerpc/8xx)
>>> by reusing set_huge_pte_at(), a HugeTLB helper gated by
>>> CONFIG_HUGETLB_PAGE. This makes the feature silently unavailable on
>>> CONFIG_HUGETLB_PAGE=n kernels and couples mm/vmalloc.c to HugeTLB
>>> internals it does not otherwise need.
>>>
>>> Add pte_set_huge() to powerpc/8xx, next to the existing
>>> pmd_clear_huge()/pud_clear_huge() in mm/nohash/8xx.c. It builds the huge
>>> PTE and writes it into the backing cells directly, without going through
>>> set_huge_pte_at(), so it does not depend on CONFIG_HUGETLB_PAGE.
>>>
>>> No pte_clear_huge() is needed: 8xx does not implement
>>> arch_vmap_pte_range_unmap_size(), so the vmap unmap path never takes the
>>> block-mapping branch.
>>>
>>> In practice PPC_8xx selects HUGETLBFS unconditionally, so
>>> CONFIG_HUGETLB_PAGE=n does not occur there today; this is a decoupling
>>> cleanup rather than a new configuration.
>>
>> 8xx selects CONFIG_HUGETLB_PAGE because it uses set_huge_pte_at() to map
>> kernel text with large pages. That was added by commit 34536d780683
>> ("powerpc/8xx: Add a function to early map kernel via huge pages")
>>
>> But now pte_set_huge() could be used instead in
>> __early_map_kernel_hugepage() and then CONFIG_HUGETLB_PAGE could be removed.
> 
> Hi Christophe,
> 
> Do you mean the code below? If so, it sounds like a good place to
> clean this up for powerpc as a separate cleanup patch.

Yes this is what I have in mind allthough I have not studied it in details.

> 
> diff --git a/arch/powerpc/mm/nohash/8xx.c b/arch/powerpc/mm/nohash/8xx.c
> index 2518d2a6bdb4..830cdb391161 100644
> --- a/arch/powerpc/mm/nohash/8xx.c
> +++ b/arch/powerpc/mm/nohash/8xx.c
> @@ -87,9 +87,7 @@ static int __ref
> __early_map_kernel_hugepage(unsigned long va, phys_addr_t pa,
>          if (WARN_ON(!ptep))
>                  return -ENOMEM;
> 
> -       set_huge_pte_at(&init_mm, va, ptep,
> -                       arch_make_huge_pte(pfn_pte(pa >> PAGE_SHIFT,
> prot), shift, 0),
> -                       1UL << shift);
> +       pte_set_huge(ptep, va, pa, prot, 1UL << shift);
> 
>          return 0;
>   }
> diff --git a/arch/powerpc/platforms/Kconfig.cputype
> b/arch/powerpc/platforms/Kconfig.cputype
> index f0adbf7ecb7f..efba4d960083 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -41,7 +41,6 @@ config PPC_8xx
>          select FSL_SOC
>          select PPC_KUEP
>          select HAVE_ARCH_VMAP_STACK
> -       select HUGETLBFS
> 
>   config 44x
>          bool "AMCC 44x, 46x or 47x"
> 
>>
>>>
>>> There is no caller yet: mm/vmalloc.c is converted later in this series,
>>> once the generic fallbacks are in place.
>>>
>>> Signed-off-by: Wen Jiang <jiangwen6@xiaomi.com>
>>
>> Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
> 
> Best Regards
> Barry


  reply	other threads:[~2026-09-18  9:11 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17  5:29 [PATCH v8 00/10] mm/vmalloc: Speed up ioremap, vmalloc and vmap with contiguous memory Wen Jiang
2026-09-17  5:29 ` [PATCH v8 01/10] arm64/mm: add pte_set_huge() and pte_clear_huge() Wen Jiang
2026-09-17 23:22   ` Barry Song
2026-09-18  7:48     ` Wen Jiang
2026-09-17  5:29 ` [PATCH v8 02/10] powerpc/8xx: add pte_set_huge() Wen Jiang
2026-09-17 23:28   ` Barry Song
2026-09-18  8:20     ` Wen Jiang
2026-09-18  6:14   ` Christophe Leroy (CS GROUP)
2026-09-18  8:44     ` Barry Song
2026-09-18  9:11       ` Christophe Leroy (CS GROUP) [this message]
2026-09-17  5:29 ` [PATCH v8 03/10] mm/vmalloc: use pte_set_huge()/pte_clear_huge() for PTE-level block mappings Wen Jiang
2026-09-17 14:00   ` Christophe Leroy (CS GROUP)
2026-09-17 14:40     ` Wen Jiang
2026-09-17 21:44       ` Barry Song
2026-09-18  6:05         ` Christophe Leroy (CS GROUP)
2026-09-18  6:14           ` Barry Song
2026-09-18  7:03             ` Christophe Leroy (CS GROUP)
2026-09-18  8:37               ` Wen Jiang
2026-09-17  5:29 ` [PATCH v8 04/10] arm64/hugetlb: drop the init_mm special case in clear_flush() Wen Jiang
2026-09-17  5:29 ` [PATCH v8 05/10] arm64/vmalloc: allow arch_vmap_pte_range_map_size() to batch multiple CONT_PTE Wen Jiang
2026-09-17  5:29 ` [PATCH v8 06/10] mm/vmalloc: extract vmap_set_ptes() to consolidate PTE mapping logic Wen Jiang
2026-09-17  5:29 ` [PATCH v8 07/10] mm/vmalloc: extend page table walk to support larger page_shift sizes and eliminate page table rewalk Wen Jiang
2026-09-17  5:29 ` [PATCH v8 08/10] mm/vmalloc: extract vm_shift() to consolidate mapping shift selection Wen Jiang
2026-09-17  5:29 ` [PATCH v8 09/10] mm/vmalloc: map contiguous pages in batches for vmap() if possible Wen Jiang
2026-09-17  5:29 ` [PATCH v8 10/10] mm/vmalloc: align vm_area so vmap() can batch mappings Wen Jiang
2026-09-17 12:17 ` [PATCH v8 00/10] mm/vmalloc: Speed up ioremap, vmalloc and vmap with contiguous memory Christophe Leroy (CS GROUP)
2026-09-17 13:55   ` Christophe Leroy (CS GROUP)
2026-09-17 14:30     ` Wen Jiang

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=930f3db4-9034-4a48-98b2-07a44de3a718@kernel.org \
    --to=chleroy@kernel.org \
    --cc=Xueyuan.chen21@gmail.com \
    --cc=ajd@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=baohua@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=jiangwen6@xiaomi.com \
    --cc=jiangwenxiaomi@gmail.com \
    --cc=leo.yan@arm.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=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=urezki@gmail.com \
    --cc=will@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

all inboxes | Powered by JetHome®