[PATCH v4 4/6] mm/hotplug: Allow pageblock alignment via altmap reservation

2023-07-17 Thread Aneesh Kumar K.V
values. Signed-off-by: Aneesh Kumar K.V --- mm/memory_hotplug.c | 109 ++-- 1 file changed, 96 insertions(+), 13 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 5921c81fcb70..c409f5ff6a59 100644 --- a/mm/memory_hotplug.c +++ b/mm

[PATCH v4 3/6] mm/hotplug: Allow architecture to override memmap on memory support check

2023-07-17 Thread Aneesh Kumar K.V
Some architectures would want different restrictions. Hence add an architecture-specific override. Both the PMD_SIZE check and pageblock alignment check are moved there. Signed-off-by: Aneesh Kumar K.V --- mm/memory_hotplug.c | 22 +++--- 1 file changed, 19 insertions(+), 3

[PATCH v4 2/6] mm/hotplug: Allow memmap on memory hotplug request to fallback

2023-07-17 Thread Aneesh Kumar K.V
If not supported, fallback to not using memap on memmory. This avoids the need for callers to do the fallback. Signed-off-by: Aneesh Kumar K.V --- drivers/acpi/acpi_memhotplug.c | 3 +-- include/linux/memory_hotplug.h | 3 ++- mm/memory_hotplug.c| 13 ++--- 3 files changed

[PATCH v4 1/6] mm/hotplug: Simplify ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE kconfig

2023-07-17 Thread Aneesh Kumar K.V
Instead of adding menu entry with all supported architectures, add mm/Kconfig variable and select the same from supported architectures. No functional change in this patch. Acked-by: David Hildenbrand Signed-off-by: Aneesh Kumar K.V --- arch/arm64/Kconfig | 4 +--- arch/x86/Kconfig | 4

[PATCH v4 0/6] Add support for memmap on memory feature on ppc64

2023-07-17 Thread Aneesh Kumar K.V
linus tree Aneesh Kumar K.V (6): mm/hotplug: Simplify ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE kconfig mm/hotplug: Allow memmap on memory hotplug request to fallback mm/hotplug: Allow architecture to override memmap on memory support check mm/hotplug: Allow pageblock alignment via altmap

[PATCH v5 13/13] powerpc/book3s64/radix: Add debug message to give more details of vmemmap allocation

2023-07-17 Thread Aneesh Kumar K.V
vmemmap mapping [ 293.550032] radix-mmu: PMD_SIZE vmemmap mapping [ 293.550076] radix-mmu: PMD_SIZE vmemmap mapping [ 293.550117] radix-mmu: PMD_SIZE vmemmap mapping Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/radix_pgtable.c | 3 +++ 1 file changed, 3 insertions(+) diff

[PATCH v5 11/13] powerpc/book3s64/radix: Add support for vmemmap optimization for radix

2023-07-17 Thread Aneesh Kumar K.V
With 2M PMD-level mapping, we require 32 struct pages and a single vmemmap page can contain 1024 struct pages (PAGE_SIZE/sizeof(struct page)). Hence with 64K page size, we don't use vmemmap deduplication for PMD-level mapping. Signed-off-by: Aneesh Kumar K.V --- Documentati

[PATCH v5 12/13] powerpc/book3s64/radix: Remove mmu_vmemmap_psize

2023-07-17 Thread Aneesh Kumar K.V
This is not used by radix anymore. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/radix_pgtable.c | 11 --- arch/powerpc/mm/init_64.c| 21 ++--- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/mm/book3s64

[PATCH v5 10/13] powerpc/book3s64/vmemmap: Switch radix to use a different vmemmap handling function

2023-07-17 Thread Aneesh Kumar K.V
page size, we need to do the above check even at the PAGE_SIZE granularity. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/radix.h | 2 + arch/powerpc/include/asm/pgtable.h | 4 + arch/powerpc/mm/book3s64/radix_pgtable.c | 326 +++-- arch/

[PATCH v5 09/13] powerpc/book3s64/mm: Enable transparent pud hugepage

2023-07-17 Thread Aneesh Kumar K.V
expected pte bit combination is _PAGE_PTE | _PAGE_DEVMAP. Some of the helpers are never expected to get called on hash translation and hence is marked to call BUG() in such a case. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/hash.h | 9 + arch/powerpc/include/asm

[PATCH v5 08/13] powerpc/mm/trace: Convert trace event to trace event class

2023-07-17 Thread Aneesh Kumar K.V
A follow-up patch will add a pud variant for this same event. Using event class makes that addition simpler. No functional change in this patch. Reviewed-by: Christophe Leroy Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/hash_pgtable.c | 2 +- arch/powerpc/mm/book3s64

[PATCH v5 07/13] mm/vmemmap optimization: Split hugetlb and devdax vmemmap optimization

2023-07-17 Thread Aneesh Kumar K.V
config is not enabled for them. With this change, arm64 should be able to select DAX optimization [1] commit 060a2c92d1b6 ("arm64: mm: hugetlb: Disable HUGETLB_PAGE_OPTIMIZE_VMEMMAP") Signed-off-by: Aneesh Kumar K.V --- arch/loongarch/Kconfig | 2 +- arch/riscv/Kconfig | 2 +

[PATCH v5 06/13] mm/huge pud: Use transparent huge pud helpers only with CONFIG_TRANSPARENT_HUGEPAGE

2023-07-17 Thread Aneesh Kumar K.V
pudp_set_wrprotect and move_huge_pud helpers are only used when CONFIG_TRANSPARENT_HUGEPAGE is enabled. Similar to pmdp_set_wrprotect and move_huge_pmd_helpers use architecture override only if CONFIG_TRANSPARENT_HUGEPAGE is set Reviewed-by: Christophe Leroy Signed-off-by: Aneesh Kumar K.V

[PATCH v5 05/13] mm: Add pud_same similar to __HAVE_ARCH_P4D_SAME

2023-07-17 Thread Aneesh Kumar K.V
This helps architectures to override pmd_same and pud_same independently. Signed-off-by: Aneesh Kumar K.V --- include/linux/pgtable.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 6fd9b2831338..ca67ecbd9a66 100644 --- a/include

[PATCH v5 04/13] mm/vmemmap: Allow architectures to override how vmemmap optimization works

2023-07-17 Thread Aneesh Kumar K.V
Architectures like powerpc will like to use different page table allocators and mapping mechanisms to implement vmemmap optimization. Similar to vmemmap_populate allow architectures to implement vmemap_populate_compound_pages Signed-off-by: Aneesh Kumar K.V --- mm/sparse-vmemmap.c | 3 +++ 1

[PATCH v5 03/13] mm/vmemmap: Improve vmemmap_can_optimize and allow architectures to override

2023-07-17 Thread Aneesh Kumar K.V
MMU translation). Hence allow architecture override. Reviewed-by: Christophe Leroy Signed-off-by: Aneesh Kumar K.V --- include/linux/mm.h | 27 +++ mm/mm_init.c | 2 +- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux

[PATCH v5 02/13] mm: Change pudp_huge_get_and_clear_full take vm_area_struct as arg

2023-07-17 Thread Aneesh Kumar K.V
We will use this in a later patch to do tlb flush when clearing pud entries on powerpc. This is similar to commit 93a98695f2f9 ("mm: change pmdp_huge_get_and_clear_full take vm_area_struct as arg") Reviewed-by: Christophe Leroy Signed-off-by: Aneesh Kumar K.V --- include/linux/pgt

[PATCH v5 00/13] Add support for DAX vmemmap optimization for ppc64

2023-07-17 Thread Aneesh Kumar K.V
tree * Address review feedback Changes from V1: * Fix make htmldocs warning * Fix vmemmap allocation bugs with different alignment values. * Correctly check for section validity to before we free vmemmap area Aneesh Kumar K.V (13): mm/hugepage pud: Allow arch-specific helper function to check hu

[PATCH v5 01/13] mm/hugepage pud: Allow arch-specific helper function to check huge page pud support

2023-07-17 Thread Aneesh Kumar K.V
Architectures like powerpc would like to enable transparent huge page pud support only with radix translation. To support that add has_transparent_pud_hugepage() helper that architectures can override. Reviewed-by: Christophe Leroy Signed-off-by: Aneesh Kumar K.V --- drivers/nvdimm/pfn_devs.c

Re: [PATCH v2] KVM: ppc64: Enable ring-based dirty memory tracking on ppc64: enable config options and implement relevant functions

2023-07-17 Thread Aneesh Kumar K.V
Kautuk Consul writes: > - Enable CONFIG_HAVE_KVM_DIRTY_RING_ACQ_REL as ppc64 is weakly > ordered. > - Enable CONFIG_NEED_KVM_DIRTY_RING_WITH_BITMAP because the > kvmppc_xive_native_set_attr is called in the context of an ioctl > syscall and will call kvmppc_xive_native_eq_sync for setting t

Re: [PATCH v3 4/7] mm/hotplug: Allow pageblock alignment via altmap reservation

2023-07-12 Thread Aneesh Kumar K.V
David Hildenbrand writes: > On 12.07.23 05:16, Aneesh Kumar K V wrote: >> On 7/11/23 10:49 PM, David Hildenbrand wrote: >>> On 11.07.23 06:48, Aneesh Kumar K.V wrote: >>>> Add a new kconfig option that can be selected if we want to allow >>>> pageblock a

[PATCH v3 6/7] dax/kmem: Always enroll hotplugged memory for memmap_on_memory

2023-07-10 Thread Aneesh Kumar K.V
ew Morton Cc: David Hildenbrand Cc: Oscar Salvador Cc: Dan Williams Cc: Dave Jiang Cc: Dave Hansen Cc: Huang Ying Signed-off-by: Vishal Verma Signed-off-by: Aneesh Kumar K.V --- drivers/dax/kmem.c | 81 +- 1 file changed, 59 insertions(+), 22 deleti

[PATCH v3 7/7] mm/hotplug: Embed vmem_altmap details in memory block

2023-07-10 Thread Aneesh Kumar K.V
functional change in this patch Signed-off-by: Aneesh Kumar K.V --- drivers/base/memory.c | 35 ++- include/linux/memory.h | 8 ++-- mm/memory_hotplug.c| 34 ++ 3 files changed, 42 insertions(+), 35 deletions(-) diff --git a

[PATCH v3 5/7] powerpc/book3s64/memhotplug: Enable memmap on memory for radix

2023-07-10 Thread Aneesh Kumar K.V
block size, we require 4 pages to map vmemmap pages, In order to align things correctly we end up adding a reserve of 28 pages. ie, for every 4096 pages 28 pages get reserved. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/pgtable.h

[PATCH v3 4/7] mm/hotplug: Allow pageblock alignment via altmap reservation

2023-07-10 Thread Aneesh Kumar K.V
values. Signed-off-by: Aneesh Kumar K.V --- mm/Kconfig | 9 +++ mm/memory_hotplug.c | 59 + 2 files changed, 58 insertions(+), 10 deletions(-) diff --git a/mm/Kconfig b/mm/Kconfig index 932349271e28..88a1472b2086 100644 --- a/mm/Kconfig

[PATCH v3 3/7] mm/hotplug: Allow architecture to override memmap on memory support check

2023-07-10 Thread Aneesh Kumar K.V
Some architectures would want different restrictions. Hence add an architecture-specific override. Both the PMD_SIZE check and pageblock alignment check are moved there. Signed-off-by: Aneesh Kumar K.V --- mm/memory_hotplug.c | 17 - 1 file changed, 12 insertions(+), 5

[PATCH v3 2/7] mm/hotplug: Allow memmap on memory hotplug request to fallback

2023-07-10 Thread Aneesh Kumar K.V
If not supported, fallback to not using memap on memmory. This avoids the need for callers to do the fallback. Signed-off-by: Aneesh Kumar K.V --- drivers/acpi/acpi_memhotplug.c | 3 +-- include/linux/memory_hotplug.h | 1 - mm/memory_hotplug.c| 13 ++--- 3 files changed

[PATCH v3 1/7] mm/hotplug: Simplify ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE kconfig

2023-07-10 Thread Aneesh Kumar K.V
Instead of adding menu entry with all supported architectures, add mm/Kconfig variable and select the same from supported architectures. No functional change in this patch. Acked-by: David Hildenbrand Signed-off-by: Aneesh Kumar K.V --- arch/arm64/Kconfig | 4 +--- arch/x86/Kconfig | 4

[PATCH v3 0/7] Add support for memmap on memory feature on ppc64

2023-07-10 Thread Aneesh Kumar K.V
store vmemmap_altmap details. This is required so that when we remove the memory we can find the altmap details which is needed on some architectures. * rebase to latest linus tree Aneesh Kumar K.V (6): mm/hotplug: Simplify ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE kconfig mm/hotplug: Allow memmap on

Re: [PATCH v4 04/13] mm/vmemmap: Allow architectures to override how vmemmap optimization works

2023-07-10 Thread Aneesh Kumar K.V
Christophe Leroy writes: > Le 10/07/2023 à 18:08, Aneesh Kumar K.V a écrit : >> Architectures like powerpc will like to use different page table allocators >> and mapping mechanisms to implement vmemmap optimization. Similar to >> vmemmap_populate allow archi

Re: [PATCH v4 03/13] mm/vmemmap: Improve vmemmap_can_optimize and allow architectures to override

2023-07-10 Thread Aneesh Kumar K.V
Christophe Leroy writes: > Le 10/07/2023 à 18:08, Aneesh Kumar K.V a écrit : >> dax vmemmap optimization requires a minimum of 2 PAGE_SIZE area within >> vmemmap such that tail page mapping can point to the second PAGE_SIZE area. >> Enforce that in vmemmap_ca

Re: [PATCH v4 05/13] mm: Add __HAVE_ARCH_PUD_SAME similar to __HAVE_ARCH_P4D_SAME

2023-07-10 Thread Aneesh Kumar K.V
Christophe Leroy writes: > Le 10/07/2023 à 18:08, Aneesh Kumar K.V a écrit : >> This helps architectures to override pmd_same and pud_same independently. >> >> Signed-off-by: Aneesh Kumar K.V > > Reviewed-by: Christophe Leroy > > Shouldn't you do it t

[PATCH v4 13/13] powerpc/book3s64/radix: Add debug message to give more details of vmemmap allocation

2023-07-10 Thread Aneesh Kumar K.V
vmemmap mapping [ 293.550032] radix-mmu: PMD_SIZE vmemmap mapping [ 293.550076] radix-mmu: PMD_SIZE vmemmap mapping [ 293.550117] radix-mmu: PMD_SIZE vmemmap mapping Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/radix_pgtable.c | 3 +++ 1 file changed, 3 insertions(+) diff

[PATCH v4 12/13] powerpc/book3s64/radix: Remove mmu_vmemmap_psize

2023-07-10 Thread Aneesh Kumar K.V
This is not used by radix anymore. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/radix_pgtable.c | 11 --- arch/powerpc/mm/init_64.c| 21 ++--- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/mm/book3s64

[PATCH v4 11/13] powerpc/book3s64/radix: Add support for vmemmap optimization for radix

2023-07-10 Thread Aneesh Kumar K.V
With 2M PMD-level mapping, we require 32 struct pages and a single vmemmap page can contain 1024 struct pages (PAGE_SIZE/sizeof(struct page)). Hence with 64K page size, we don't use vmemmap deduplication for PMD-level mapping. Signed-off-by: Aneesh Kumar K.V --- Documentati

[PATCH v4 10/13] powerpc/book3s64/vmemmap: Switch radix to use a different vmemmap handling function

2023-07-10 Thread Aneesh Kumar K.V
page size, we need to do the above check even at the PAGE_SIZE granularity. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/radix.h | 2 + arch/powerpc/include/asm/pgtable.h | 4 + arch/powerpc/mm/book3s64/radix_pgtable.c | 326 +++-- arch/

[PATCH v4 09/13] powerpc/book3s64/mm: Enable transparent pud hugepage

2023-07-10 Thread Aneesh Kumar K.V
expected pte bit combination is _PAGE_PTE | _PAGE_DEVMAP. Some of the helpers are never expected to get called on hash translation and hence is marked to call BUG() in such a case. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/hash.h | 9 + arch/powerpc/include/asm

[PATCH v4 08/13] powerpc/mm/trace: Convert trace event to trace event class

2023-07-10 Thread Aneesh Kumar K.V
A follow-up patch will add a pud variant for this same event. Using event class makes that addition simpler. No functional change in this patch. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/hash_pgtable.c | 2 +- arch/powerpc/mm/book3s64/radix_pgtable.c | 2 +- include/trace

[PATCH v4 07/13] mm/vmemmap optimization: Split hugetlb and devdax vmemmap optimization

2023-07-10 Thread Aneesh Kumar K.V
config is not enabled for them. With this change, arm64 should be able to select DAX optimization [1] commit 060a2c92d1b6 ("arm64: mm: hugetlb: Disable HUGETLB_PAGE_OPTIMIZE_VMEMMAP") Signed-off-by: Aneesh Kumar K.V --- arch/loongarch/Kconfig | 2 +- arch/riscv/Kconfig | 2 +

[PATCH v4 06/13] mm/huge pud: Use transparent huge pud helpers only with CONFIG_TRANSPARENT_HUGEPAGE

2023-07-10 Thread Aneesh Kumar K.V
pudp_set_wrprotect and move_huge_pud helpers are only used when CONFIG_TRANSPARENT_HUGEPAGE is enabled. Similar to pmdp_set_wrprotect and move_huge_pmd_helpers use architecture override only if CONFIG_TRANSPARENT_HUGEPAGE is set Signed-off-by: Aneesh Kumar K.V --- include/linux/pgtable.h | 2

[PATCH v4 05/13] mm: Add __HAVE_ARCH_PUD_SAME similar to __HAVE_ARCH_P4D_SAME

2023-07-10 Thread Aneesh Kumar K.V
This helps architectures to override pmd_same and pud_same independently. Signed-off-by: Aneesh Kumar K.V --- include/linux/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 6fd9b2831338..91def34f7784 100644 --- a/include

[PATCH v4 04/13] mm/vmemmap: Allow architectures to override how vmemmap optimization works

2023-07-10 Thread Aneesh Kumar K.V
Architectures like powerpc will like to use different page table allocators and mapping mechanisms to implement vmemmap optimization. Similar to vmemmap_populate allow architectures to implement vmemap_populate_compound_pages Signed-off-by: Aneesh Kumar K.V --- mm/sparse-vmemmap.c | 3 +++ 1

[PATCH v4 03/13] mm/vmemmap: Improve vmemmap_can_optimize and allow architectures to override

2023-07-10 Thread Aneesh Kumar K.V
MMU translation). Hence allow architecture override. Signed-off-by: Aneesh Kumar K.V --- include/linux/mm.h | 27 +++ mm/mm_init.c | 2 +- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 2dd73e4f3d8e

[PATCH v4 02/13] mm: Change pudp_huge_get_and_clear_full take vm_area_struct as arg

2023-07-10 Thread Aneesh Kumar K.V
We will use this in a later patch to do tlb flush when clearing pud entries on powerpc. This is similar to commit 93a98695f2f9 ("mm: change pmdp_huge_get_and_clear_full take vm_area_struct as arg") Signed-off-by: Aneesh Kumar K.V --- include/linux/pgtable.h | 4 ++-- mm/debug_vm_pgtab

[PATCH v4 01/13] mm/hugepage pud: Allow arch-specific helper function to check huge page pud support

2023-07-10 Thread Aneesh Kumar K.V
Architectures like powerpc would like to enable transparent huge page pud support only with radix translation. To support that add has_transparent_pud_hugepage() helper that architectures can override. Signed-off-by: Aneesh Kumar K.V --- drivers/nvdimm/pfn_devs.c | 2 +- include/linux/pgtable.h

[PATCH v4 00/13] Add support for DAX vmemmap optimization for ppc64

2023-07-10 Thread Aneesh Kumar K.V
s warning * Fix vmemmap allocation bugs with different alignment values. * Correctly check for section validity to before we free vmemmap area Aneesh Kumar K.V (13): mm/hugepage pud: Allow arch-specific helper function to check huge page pud support mm: Change pudp_huge_get_and_

[PATCH v2 1/5] mm/hotplug: Embed vmem_altmap details in memory block

2023-07-06 Thread Aneesh Kumar K.V
using vmem_altmap, the kernel fails to unplug the memory if the request is not a single memory block unplug. Signed-off-by: Aneesh Kumar K.V --- drivers/base/memory.c| 28 +++- include/linux/memory.h | 25 +++-- include/linux/memremap.h | 18

[PATCH v3 13/13] powerpc/book3s64/radix: Add debug message to give more details of vmemmap allocation

2023-07-06 Thread Aneesh Kumar K.V
vmemmap mapping [ 293.550032] radix-mmu: PMD_SIZE vmemmap mapping [ 293.550076] radix-mmu: PMD_SIZE vmemmap mapping [ 293.550117] radix-mmu: PMD_SIZE vmemmap mapping Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/radix_pgtable.c | 3 +++ 1 file changed, 3 insertions(+) diff

[PATCH v3 12/13] powerpc/book3s64/radix: Remove mmu_vmemmap_psize

2023-07-06 Thread Aneesh Kumar K.V
This is not used by radix anymore. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/radix_pgtable.c | 11 --- arch/powerpc/mm/init_64.c| 21 ++--- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/mm/book3s64

[PATCH v3 11/13] powerpc/book3s64/radix: Add support for vmemmap optimization for radix

2023-07-06 Thread Aneesh Kumar K.V
With 2M PMD-level mapping, we require 32 struct pages and a single vmemmap page can contain 1024 struct pages (PAGE_SIZE/sizeof(struct page)). Hence with 64K page size, we don't use vmemmap deduplication for PMD-level mapping. Signed-off-by: Aneesh Kumar K.V --- Documentati

[PATCH v3 10/13] powerpc/book3s64/vmemmap: Switch radix to use a different vmemmap handling function

2023-07-06 Thread Aneesh Kumar K.V
page size, we need to do the above check even at the PAGE_SIZE granularity. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/radix.h | 2 + arch/powerpc/include/asm/pgtable.h | 4 + arch/powerpc/mm/book3s64/radix_pgtable.c | 318 +++-- arch/

[PATCH v3 09/13] powerpc/book3s64/mm: Enable transparent pud hugepage

2023-07-06 Thread Aneesh Kumar K.V
expected pte bit combination is _PAGE_PTE | _PAGE_DEVMAP. Some of the helpers are never expected to get called on hash translation and hence is marked to call BUG() in such a case. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/pgtable.h | 156 -- arch

[PATCH v3 08/13] powerpc/mm/trace: Convert trace event to trace event class

2023-07-06 Thread Aneesh Kumar K.V
A follow-up patch will add a pud variant for this same event. Using event class makes that addition simpler. No functional change in this patch. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/hash_pgtable.c | 2 +- arch/powerpc/mm/book3s64/radix_pgtable.c | 2 +- include/trace

[PATCH v3 07/13] mm/vmemmap optimization: Split hugetlb and devdax vmemmap optimization

2023-07-06 Thread Aneesh Kumar K.V
config is not enabled for them. With this change, arm64 should be able to select DAX optimization [1] commit 060a2c92d1b6 ("arm64: mm: hugetlb: Disable HUGETLB_PAGE_OPTIMIZE_VMEMMAP") Signed-off-by: Aneesh Kumar K.V --- arch/loongarch/Kconfig | 2 +- arch/riscv/Kconfig | 2 +

[PATCH v3 06/13] mm/huge pud: Use transparent huge pud helpers only with CONFIG_TRANSPARENT_HUGEPAGE

2023-07-06 Thread Aneesh Kumar K.V
pudp_set_wrprotect and move_huge_pud helpers are only used when CONFIG_TRANSPARENT_HUGEPAGE is enabled. Similar to pmdp_set_wrprotect and move_huge_pmd_helpers use architecture override only if CONFIG_TRANSPARENT_HUGEPAGE is set Signed-off-by: Aneesh Kumar K.V --- include/linux/pgtable.h | 2

[PATCH v3 05/13] mm: Add __HAVE_ARCH_PUD_SAME similar to __HAVE_ARCH_P4D_SAME

2023-07-06 Thread Aneesh Kumar K.V
This helps architectures to override pmd_same and pud_same independently. Signed-off-by: Aneesh Kumar K.V --- include/linux/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 6fd9b2831338..91def34f7784 100644 --- a/include

[PATCH v3 04/13] mm/vmemmap: Allow architectures to override how vmemmap optimization works

2023-07-06 Thread Aneesh Kumar K.V
Architectures like powerpc will like to use different page table allocators and mapping mechanisms to implement vmemmap optimization. Similar to vmemmap_populate allow architectures to implement vmemap_populate_compound_pages Signed-off-by: Aneesh Kumar K.V --- mm/sparse-vmemmap.c | 3 +++ 1

[PATCH v3 03/13] mm/vmemmap: Improve vmemmap_can_optimize and allow architectures to override

2023-07-06 Thread Aneesh Kumar K.V
MMU translation). Hence allow architecture override. Signed-off-by: Aneesh Kumar K.V --- include/linux/mm.h | 27 +++ mm/mm_init.c | 2 +- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 2dd73e4f3d8e

[PATCH v3 01/13] mm/hugepage pud: Allow arch-specific helper function to check huge page pud support

2023-07-06 Thread Aneesh Kumar K.V
Architectures like powerpc would like to enable transparent huge page pud support only with radix translation. To support that add has_transparent_pud_hugepage() helper that architectures can override. Signed-off-by: Aneesh Kumar K.V --- drivers/nvdimm/pfn_devs.c | 2 +- include/linux/pgtable.h

[PATCH v3 02/13] mm: Change pudp_huge_get_and_clear_full take vm_area_struct as arg

2023-07-06 Thread Aneesh Kumar K.V
We will use this in a later patch to do tlb flush when clearing pud entries on powerpc. This is similar to commit 93a98695f2f9 ("mm: change pmdp_huge_get_and_clear_full take vm_area_struct as arg") Signed-off-by: Aneesh Kumar K.V --- include/linux/pgtable.h | 4 ++-- mm/debug_vm_pgtab

[PATCH v3 00/13] Add support for DAX vmemmap optimization for ppc64

2023-07-06 Thread Aneesh Kumar K.V
ee vmemmap area Aneesh Kumar K.V (13): mm/hugepage pud: Allow arch-specific helper function to check huge page pud support mm: Change pudp_huge_get_and_clear_full take vm_area_struct as arg mm/vmemmap: Improve vmemmap_can_optimize and allow architectures to override mm/vmemmap: Allow a

[PATCH v2 5/5] powerpc/book3s64/memhotplug: Enable memmap on memory for radix

2023-07-06 Thread Aneesh Kumar K.V
, we require 4 pages to map vmemmap pages, In order to align things correctly we end up adding a reserve of 28 pages. ie, for every 4096 pages 28 pages get reserved. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/Kconfig | 1 + arch/powerpc/mm/book3s64/radix_pgtable.c

[PATCH v2 4/5] mm/hotplug: Simplify ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE kconfig

2023-07-06 Thread Aneesh Kumar K.V
Instead of adding menu entry with all supported architectures, add mm/Kconfig variable and select the same from supported architectures. No functional change in this patch. Signed-off-by: Aneesh Kumar K.V --- arch/arm64/Kconfig | 4 +--- arch/x86/Kconfig | 4 +--- mm/Kconfig | 3

[PATCH v2 3/5] mm/hotplug: Simplify the handling of MHP_MEMMAP_ON_MEMORY flag

2023-07-06 Thread Aneesh Kumar K.V
flag unconditionally because the kernel will fallback to not using the feature if the alignment rules are not met. Signed-off-by: Aneesh Kumar K.V --- drivers/acpi/acpi_memhotplug.c | 3 +-- include/linux/memory_hotplug.h | 14 ++ mm/memory_hotplug.c| 35

[PATCH v2 2/5] mm/hotplug: Allow architecture override for memmap on memory feature

2023-07-06 Thread Aneesh Kumar K.V
use this. Signed-off-by: Aneesh Kumar K.V --- arch/arm64/mm/mmu.c| 5 + arch/x86/mm/init_64.c | 6 ++ include/linux/memory_hotplug.h | 3 ++- mm/memory_hotplug.c| 36 -- 4 files changed, 39 insertions(+), 11 deletions

[PATCH v2 0/5] Add support for memmap on memory feature on ppc64

2023-07-06 Thread Aneesh Kumar K.V
on some architectures. * rebase to latest linus tree Aneesh Kumar K.V (5): mm/hotplug: Embed vmem_altmap details in memory block mm/hotplug: Allow architecture override for memmap on memory feature mm/hotplug: Simplify the handling of MHP_MEMMAP_ON_MEMORY flag mm/hotplug: Simplify

[PATCH] powerpc/mm/book3s64/hash/4k: Add pmd_same callback for 4K page size

2023-07-05 Thread Aneesh Kumar K.V
0xbc/0x1a0 ret_from_kernel_user_thread+0x14/0x1c Cc: Hugh Dickins Reported-by: Michael Ellerman Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/hash-4k.h | 6 -- arch/powerpc/include/asm/book3s/64/hash-64k.h | 5 - arch/powerpc/include/asm/book3s/64/hash.h |

[RFC PATCH 5/5] powerpc/book3s64/memhotplug: Enable memmap on memory for radix

2023-06-26 Thread Aneesh Kumar K.V
, we require 4 pages to map vmemmap pages, In order to align things correctly we end up adding a reserve of 28 pages. ie, for every 4096 pages 28 pages get reserved. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/Kconfig | 1 + arch/powerpc/mm/book3s64/radix_pgtable.c

[RFC PATCH 4/5] mm/hotplug: Simplify ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE kconfig

2023-06-26 Thread Aneesh Kumar K.V
Instead of adding menu entry with all supported architectures, add mm/Kconfig variable and select the same from supported architectures. No functional change in this patch. Signed-off-by: Aneesh Kumar K.V --- arch/arm64/Kconfig | 4 +--- arch/x86/Kconfig | 4 +--- mm/Kconfig | 3

[RFC PATCH 3/5] mm/hotplug: Simplify the handling of MHP_MEMMAP_ON_MEMORY flag

2023-06-26 Thread Aneesh Kumar K.V
flag unconditionally because the kernel will fallback to not using the feature if the alignment rules are not met. Signed-off-by: Aneesh Kumar K.V --- drivers/acpi/acpi_memhotplug.c | 3 +-- include/linux/memory_hotplug.h | 14 ++ mm/memory_hotplug.c| 19

[RFC PATCH 2/5] mm/hotplug: Allow architecture override for memmap on memory feature

2023-06-26 Thread Aneesh Kumar K.V
use this. Signed-off-by: Aneesh Kumar K.V --- arch/arm64/mm/mmu.c| 5 + arch/x86/mm/init_64.c | 6 ++ include/linux/memory_hotplug.h | 3 ++- mm/memory_hotplug.c| 36 -- 4 files changed, 39 insertions(+), 11 deletions

[RFC PATCH 1/5] mm/hotplug: Embed vmem_altmap details in memory block

2023-06-26 Thread Aneesh Kumar K.V
using vmem_altmap, the kernel fails to unplug the memory if the request is not a single memory block unplug. Signed-off-by: Aneesh Kumar K.V --- drivers/base/memory.c| 28 ++- include/linux/memory.h | 25 ++-- include/linux/memremap.h | 18

[RFC PATCH 0/5] Add support for memmap on memory feature on ppc64

2023-06-26 Thread Aneesh Kumar K.V
dax vmemmap optimization series posted here https://lore.kernel.org/linux-mm/20230616110826.344417-1-aneesh.ku...@linux.ibm.com Aneesh Kumar K.V (5): mm/hotplug: Embed vmem_altmap details in memory block mm/hotplug: Allow architecture override for memmap on memory feature mm/hotplug

Re: [PATCH v2 00/16] Add support for DAX vmemmap optimization for ppc64

2023-06-24 Thread Aneesh Kumar K.V
Hi Andrew, "Aneesh Kumar K.V" writes: > This patch series implements changes required to support DAX vmemmap > optimization for ppc64. The vmemmap optimization is only enabled with radix > MMU > translation and 1GB PUD mapping with 64K page size. The patch series a

Re: [PATCH v2 08/16] mm/vmemmap: Improve vmemmap_can_optimize and allow architectures to override

2023-06-20 Thread Aneesh Kumar K.V
Joao Martins writes: > On 16/06/2023 12:08, Aneesh Kumar K.V wrote: >> dax vmemmap optimization requires a minimum of 2 PAGE_SIZE area within >> vmemmap such that tail page mapping can point to the second PAGE_SIZE area. >> Enforce that in vmemmap_can_optimize() function.

Re: [PATCH v2 2/2] powerpc/mm: Add memory_block_size as a kernel parameter

2023-06-19 Thread Aneesh Kumar K.V
David Hildenbrand writes: > On 09.06.23 08:08, Aneesh Kumar K.V wrote: >> Certain devices can possess non-standard memory capacities, not constrained >> to multiples of 1GB. Provide a kernel parameter so that we can map the >> device memory completely on memory hotplug. &g

[PATCH v2 11/16] mm/huge pud: Use transparent huge pud helpers only with CONFIG_TRANSPARENT_HUGEPAGE

2023-06-16 Thread Aneesh Kumar K.V
pudp_set_wrprotect and move_huge_pud helpers are only used when CONFIG_TRANSPARENT_HUGEPAGE is enabled. Similar to pmdp_set_wrprotect and move_huge_pmd_helpers use architecture override only if CONFIG_TRANSPARENT_HUGEPAGE is set Signed-off-by: Aneesh Kumar K.V --- include/linux/pgtable.h | 2

[PATCH v2 09/16] mm/vmemmap: Allow architectures to override how vmemmap optimization works

2023-06-16 Thread Aneesh Kumar K.V
Architectures like powerpc will like to use different page table allocators and mapping mechanisms to implement vmemmap optimization. Similar to vmemmap_populate allow architectures to implement vmemap_populate_compound_pages Signed-off-by: Aneesh Kumar K.V --- mm/sparse-vmemmap.c | 3 +++ 1

[PATCH v2 16/16] powerpc/book3s64/radix: Remove mmu_vmemmap_psize

2023-06-16 Thread Aneesh Kumar K.V
This is not used by radix anymore. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/radix_pgtable.c | 10 -- arch/powerpc/mm/init_64.c| 21 ++--- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/mm/book3s64

[PATCH v2 15/16] powerpc/book3s64/radix: Add support for vmemmap optimization for radix

2023-06-16 Thread Aneesh Kumar K.V
With 2M PMD-level mapping, we require 32 struct pages and a single vmemmap page can contain 1024 struct pages (PAGE_SIZE/sizeof(struct page)). Hence with 64K page size, we don't use vmemmap deduplication for PMD-level mapping. Signed-off-by: Aneesh Kumar K.V --- Documentati

[PATCH v2 14/16] powerpc/book3s64/vmemmap: Switch radix to use a different vmemmap handling function

2023-06-16 Thread Aneesh Kumar K.V
page size, we need to do the above check even at the PAGE_SIZE granularity. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/radix.h | 2 + arch/powerpc/include/asm/pgtable.h | 3 + arch/powerpc/mm/book3s64/radix_pgtable.c | 319 +++-- arch/

[PATCH v2 13/16] powerpc/book3s64/mm: Enable transparent pud hugepage

2023-06-16 Thread Aneesh Kumar K.V
expected pte bit combination is _PAGE_PTE | _PAGE_DEVMAP. Some of the helpers are never expected to get called on hash translation and hence is marked to call BUG() in such a case. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/pgtable.h | 156 -- arch

[PATCH v2 12/16] mm/vmemmap optimization: Split hugetlb and devdax vmemmap optimization

2023-06-16 Thread Aneesh Kumar K.V
fig is not enabled for them. With this change, arm64 should be able to select DAX optimization [1] commit 060a2c92d1b6 ("arm64: mm: hugetlb: Disable HUGETLB_PAGE_OPTIMIZE_VMEMMAP") Signed-off-by: Aneesh Kumar K.V --- arch/loongarch/Kconfig | 2 +- arch/riscv/Kconfig | 2 +- arch/x

[PATCH v2 10/16] mm: Add __HAVE_ARCH_PUD_SAME similar to __HAVE_ARCH_P4D_SAME

2023-06-16 Thread Aneesh Kumar K.V
This helps architectures to override pmd_same and pud_same independently. Signed-off-by: Aneesh Kumar K.V --- include/linux/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 2fe19720075e..8c5174d1f9db 100644 --- a/include

[PATCH v2 08/16] mm/vmemmap: Improve vmemmap_can_optimize and allow architectures to override

2023-06-16 Thread Aneesh Kumar K.V
MMU translation). Hence allow architecture override. Signed-off-by: Aneesh Kumar K.V --- include/linux/mm.h | 30 ++ mm/mm_init.c | 2 +- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 27ce77080c79

[PATCH v2 07/16] mm: Change pudp_huge_get_and_clear_full take vm_area_struct as arg

2023-06-16 Thread Aneesh Kumar K.V
We will use this in a later patch to do tlb flush when clearing pud entries on powerpc. This is similar to commit 93a98695f2f9 ("mm: change pmdp_huge_get_and_clear_full take vm_area_struct as arg") Signed-off-by: Aneesh Kumar K.V --- include/linux/pgtable.h | 4 ++-- mm/debug_vm_pgtab

[PATCH v2 06/16] mm/hugepage pud: Allow arch-specific helper function to check huge page pud support

2023-06-16 Thread Aneesh Kumar K.V
Architectures like powerpc would like to enable transparent huge page pud support only with radix translation. To support that add has_transparent_pud_hugepage() helper that architectures can override. Signed-off-by: Aneesh Kumar K.V --- drivers/nvdimm/pfn_devs.c | 2 +- include/linux/pgtable.h

[PATCH v2 05/16] powerpc/mm/dax: Fix the condition when checking if altmap vmemap can cross-boundary

2023-06-16 Thread Aneesh Kumar K.V
Without this fix, the last subsection vmemmap can end up in memory even if the namespace is created with -M mem and has sufficient space in the altmap area. Fixes: cf387d9644d8 ("libnvdimm/altmap: Track namespace boundaries in altmap") Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/

[PATCH v2 04/16] powerpc/book3s64/mm: Use PAGE_KERNEL instead of opencoding

2023-06-16 Thread Aneesh Kumar K.V
No functional change in this patch. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/radix_pgtable.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c index 15a099e53cde

[PATCH v2 03/16] powerpc/book3s64/mm: Fix DirectMap stats in /proc/meminfo

2023-06-16 Thread Aneesh Kumar K.V
: 0 kB DirectMap64k: 0 kB DirectMap2M:104857600 kB DirectMap1G: 0 kB Fixes: a2dc009afa9a ("powerpc/mm/book3s/radix: Add mapping statistics") Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/radix_pgtable.c | 34 +++- 1 fi

[PATCH v2 02/16] powerpc/book3s64/mm: mmu_vmemmap_psize is used by radix

2023-06-16 Thread Aneesh Kumar K.V
This should not be within CONFIG_PPC_64S_HASHS_MMU. We use mmu_vmemmap_psize on radix while mapping the vmemmap area. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/radix_pgtable.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b

[PATCH v2 01/16] powerpc/mm/book3s64: Use pmdp_ptep helper instead of typecasting.

2023-06-16 Thread Aneesh Kumar K.V
No functional change in this patch. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/radix_pgtable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c index 2297aa764ecd

[PATCH v2 00/16] Add support for DAX vmemmap optimization for ppc64

2023-06-16 Thread Aneesh Kumar K.V
ion: Split hugetlb and devdax vmemmap optimization" Changes from V1: * Fix make htmldocs warning * Fix vmemmap allocation bugs with different alignment values. * Correctly check for section validity to before we free vmemmap area Aneesh Kumar K.V (16): powerpc/mm/book3s64: Use pmdp_ptep he

Re: [PATCH 14/16] powerpc/book3s64/vmemmap: Switch radix to use a different vmemmap handling function

2023-06-14 Thread Aneesh Kumar K.V
ze, we need to do the above check even at the PAGE_SIZE granularity. >> >> Signed-off-by: Aneesh Kumar K.V >> --- > > With this patch series applied I see the following warning > > [ OK ] Started Monitoring of LVM2 mirrors,…sing dmeventd or progress >

Re: [PATCH 00/16] Add support for DAX vmemmap optimization for ppc64

2023-06-13 Thread Aneesh Kumar K.V
"Aneesh Kumar K.V" writes: > This patch series implements changes required to support DAX vmemmap > optimization for ppc64. The vmemmap optimization is only enabled with radix > MMU > translation and 1GB PUD mapping with 64K page size. The patch series also >

[PATCH v2 2/2] powerpc/mm: Add memory_block_size as a kernel parameter

2023-06-08 Thread Aneesh Kumar K.V
also be more than the section size. Signed-off-by: Aneesh Kumar K.V --- .../admin-guide/kernel-parameters.txt | 3 +++ arch/powerpc/kernel/setup_64.c| 23 +++ arch/powerpc/mm/init_64.c | 17 ++ 3 files changed, 38 insertions

[PATCH v2 1/2] powerpc/mm: Cleanup memory block size probing

2023-06-08 Thread Aneesh Kumar K.V
block size value. Signed-off-by: Aneesh Kumar K.V --- Changes from v1: * Add a helper to parse device tree for memory block size * Drop pseries and powernv functions used. arch/powerpc/include/asm/book3s/64/mmu.h | 5 +- arch/powerpc/mm/book3s64/radix_pgtable.c | 65

[PATCH 1/2] powerpc/book3s64/mm: Remove radix_mem_block_size

2023-06-07 Thread Aneesh Kumar K.V
correct machine-specific callback is assigned. No functional change in this patch. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/book3s/64/mmu.h | 5 -- arch/powerpc/mm/book3s64/radix_pgtable.c | 64 +--- arch/powerpc/platforms/powernv/setup.c | 4 +- 3

[PATCH 2/2] powerpc/mm: Add memory_block_size as a kernel parameter

2023-06-07 Thread Aneesh Kumar K.V
also be more than the section size. Signed-off-by: Aneesh Kumar K.V --- .../admin-guide/kernel-parameters.txt | 3 +++ arch/powerpc/kernel/setup_64.c| 27 +++ 2 files changed, 30 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b

[PATCH 16/16] powerpc/book3s64/radix: Remove mmu_vmemmap_psize

2023-06-05 Thread Aneesh Kumar K.V
This is not used by radix anymore. Signed-off-by: Aneesh Kumar K.V --- arch/powerpc/mm/book3s64/radix_pgtable.c | 10 -- arch/powerpc/mm/init_64.c| 21 ++--- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/mm/book3s64

<    1   2   3   4   5   6   7   8   9   10   >