linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v9 0/4] mm: Enable conversion of powerpc to default topdown mmap layout
@ 2022-04-08  7:24 Christophe Leroy
  2022-04-08  7:24 ` [PATCH v9 1/4] mm: Allow arch specific arch_randomize_brk() with CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT Christophe Leroy
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Christophe Leroy @ 2022-04-08  7:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Christophe Leroy, linux-kernel, linux-mm, linuxppc-dev

Rebased on top of Linux 5.18-rc1

This is the mm part of the series that converts powerpc to default
topdown mmap layout, for merge into v5.18

powerpc requires its own arch_get_unmapped_area() only when
slices are needed, which is only for book3s/64. First part of
the series moves slices into book3s/64 specific directories
and cleans up other subarchitectures.

The actual convertion of powerpc to default topdown mmap layout will
then be resent in a follow-up series for application on v5.19

First patch modifies the core mm to allow powerpc to still provide its
own arch_randomize_brk()

Second patch modifies core mm to give len and flags to
arch_get_mmap_end() as powerpc needs it. 

Third patch modifies core mm to allow powerpc to use generic versions
of get_unmapped_area functions for Radix while still providing its own
implementation for Hash, the selection between Radix and Hash being
done at runtime.

Fourth patch is a complement/fix of f6795053dac8 ("mm: mmap: Allow for
"high" userspace addresses") for hugetlb. It adds support for "high"
userspace addresses that are optionally supported on the system and
have to be requested via a hint mechanism ("high" addr parameter to mmap).

Previous version of the series is available at
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?state=*&series=289718

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>

Changes in v9:
- Sending mm patches and powerpc patches separately with the objective
of mm patches going into kernel v5.18 and powerpc patches folling up
into kernel v5.19

Changes in v8:
- Moved patch "sizes.h: Add SZ_1T macro" up from which is already in linux-next but not in Linus tree yet.
- Rebased on today's powerpc/next

Changes in v7:
- Taken into account comments from Catalin (patches 3 and 4)

Changes in v6:
- New patch (patch 4) to take arch_get_mmap_base() and arch_get_mmap_end() into account in generic hugetlb_get_unmapped_area()
- Get back arch_randomize_brk() simplification as it relies on default topdown mmap layout.
- Fixed precedence between || and && in powerpc's arch_get_mmap_end() (patch 9)

Changes in v5:
- Added patch 3
- Added arch_get_mmap_base() and arch_get_mmap_end() to patch 7 to better match original powerpc behaviour
- Switched patched 10 and 11 and performed full randomisation in patch 10 just before switching to default implementation, as suggested by Nic.

Changes in v4:
- Move arch_randomize_brk() simplification out of this series
- Add a change to core mm to enable using generic implementation
while providing arch specific one at the same time.
- Reworked radix get_unmapped_area to use generic implementation
- Rebase on top of Nic's series v6

Changes in v3:
- Fixed missing <linux/elf-randomize.h> in last patch
- Added a patch to move SZ_1T out of drivers/pci/controller/pci-xgene.c

Changes in v2:
- Moved patch 4 before patch 2
- Make generic arch_randomize_brk() __weak
- Added patch 9

Christophe Leroy (4):
  mm: Allow arch specific arch_randomize_brk() with
    CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
  mm, hugetlbfs: Allow an arch to always use generic versions of
    get_unmapped_area functions
  mm: Add len and flags parameters to arch_get_mmap_end()
  mm, hugetlbfs: Allow for "high" userspace addresses

 arch/arm64/include/asm/processor.h |  4 +--
 fs/hugetlbfs/inode.c               | 26 ++++++++++++------
 include/linux/hugetlb.h            |  5 ++++
 include/linux/sched/mm.h           | 17 ++++++++++++
 mm/mmap.c                          | 43 ++++++++++++++++++------------
 mm/util.c                          |  2 +-
 6 files changed, 69 insertions(+), 28 deletions(-)

-- 
2.35.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v9 1/4] mm: Allow arch specific arch_randomize_brk() with CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
  2022-04-08  7:24 [PATCH v9 0/4] mm: Enable conversion of powerpc to default topdown mmap layout Christophe Leroy
@ 2022-04-08  7:24 ` Christophe Leroy
  2022-04-08  7:25 ` [PATCH v9 2/4] mm, hugetlbfs: Allow an arch to always use generic versions of get_unmapped_area functions Christophe Leroy
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2022-04-08  7:24 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christophe Leroy, linux-kernel, linux-mm, linuxppc-dev, Alexandre Ghiti

Commit e7142bf5d231 ("arm64, mm: make randomization selected by
generic topdown mmap layout") introduced a default version of
arch_randomize_brk() provided when
CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT is selected.

powerpc could select CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
but needs to provide its own arch_randomize_brk().

In order to allow that, define generic version of arch_randomize_brk()
as a __weak symbol.

Cc: Alexandre Ghiti <alex@ghiti.fr>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 mm/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/util.c b/mm/util.c
index 54e5e761a9a9..0787fe4af4ac 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -344,7 +344,7 @@ unsigned long randomize_stack_top(unsigned long stack_top)
 }
 
 #ifdef CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
-unsigned long arch_randomize_brk(struct mm_struct *mm)
+unsigned long __weak arch_randomize_brk(struct mm_struct *mm)
 {
 	/* Is the current task 32bit ? */
 	if (!IS_ENABLED(CONFIG_64BIT) || is_compat_task())
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v9 2/4] mm, hugetlbfs: Allow an arch to always use generic versions of get_unmapped_area functions
  2022-04-08  7:24 [PATCH v9 0/4] mm: Enable conversion of powerpc to default topdown mmap layout Christophe Leroy
  2022-04-08  7:24 ` [PATCH v9 1/4] mm: Allow arch specific arch_randomize_brk() with CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT Christophe Leroy
@ 2022-04-08  7:25 ` Christophe Leroy
  2022-04-08  7:25 ` [PATCH v9 3/4] mm: Add len and flags parameters to arch_get_mmap_end() Christophe Leroy
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2022-04-08  7:25 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christophe Leroy, linux-kernel, linux-mm, linuxppc-dev, Nicholas Piggin

Unlike most architectures, powerpc can only define at runtime
if it is going to use the generic arch_get_unmapped_area() or not.

Today, powerpc has a copy of the generic arch_get_unmapped_area()
because when selection HAVE_ARCH_UNMAPPED_AREA the generic
arch_get_unmapped_area() is not available.

Rename it generic_get_unmapped_area() and make it independent of
HAVE_ARCH_UNMAPPED_AREA.

Do the same for arch_get_unmapped_area_topdown() versus
HAVE_ARCH_UNMAPPED_AREA_TOPDOWN.

Do the same for hugetlb_get_unmapped_area() versus
HAVE_ARCH_HUGETLB_UNMAPPED_AREA.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
---
 fs/hugetlbfs/inode.c     | 17 +++++++++++++----
 include/linux/hugetlb.h  |  5 +++++
 include/linux/sched/mm.h |  9 +++++++++
 mm/mmap.c                | 31 ++++++++++++++++++++++++-------
 4 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 99c7477cee5c..09c8313ee1c4 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -195,7 +195,6 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
  * Called under mmap_write_lock(mm).
  */
 
-#ifndef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
 static unsigned long
 hugetlb_get_unmapped_area_bottomup(struct file *file, unsigned long addr,
 		unsigned long len, unsigned long pgoff, unsigned long flags)
@@ -244,9 +243,10 @@ hugetlb_get_unmapped_area_topdown(struct file *file, unsigned long addr,
 	return addr;
 }
 
-static unsigned long
-hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
-		unsigned long len, unsigned long pgoff, unsigned long flags)
+unsigned long
+generic_hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
+				  unsigned long len, unsigned long pgoff,
+				  unsigned long flags)
 {
 	struct mm_struct *mm = current->mm;
 	struct vm_area_struct *vma;
@@ -282,6 +282,15 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
 	return hugetlb_get_unmapped_area_bottomup(file, addr, len,
 			pgoff, flags);
 }
+
+#ifndef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
+static unsigned long
+hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
+			  unsigned long len, unsigned long pgoff,
+			  unsigned long flags)
+{
+	return generic_hugetlb_get_unmapped_area(file, addr, len, pgoff, flags);
+}
 #endif
 
 static size_t
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 53c1b6082a4c..10895adc7635 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -513,6 +513,11 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
 					unsigned long flags);
 #endif /* HAVE_ARCH_HUGETLB_UNMAPPED_AREA */
 
+unsigned long
+generic_hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
+				  unsigned long len, unsigned long pgoff,
+				  unsigned long flags);
+
 /*
  * huegtlb page specific state flags.  These flags are located in page.private
  * of the hugetlb head page.  Functions created via the below macros should be
diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
index a80356e9dc69..18b2d2b2e0ca 100644
--- a/include/linux/sched/mm.h
+++ b/include/linux/sched/mm.h
@@ -145,6 +145,15 @@ extern unsigned long
 arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
 			  unsigned long len, unsigned long pgoff,
 			  unsigned long flags);
+
+unsigned long
+generic_get_unmapped_area(struct file *filp, unsigned long addr,
+			  unsigned long len, unsigned long pgoff,
+			  unsigned long flags);
+unsigned long
+generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
+				  unsigned long len, unsigned long pgoff,
+				  unsigned long flags);
 #else
 static inline void arch_pick_mmap_layout(struct mm_struct *mm,
 					 struct rlimit *rlim_stack) {}
diff --git a/mm/mmap.c b/mm/mmap.c
index 3aa839f81e63..08b40a9715ee 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2136,10 +2136,10 @@ unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info)
  *
  * This function "knows" that -ENOMEM has the bits set.
  */
-#ifndef HAVE_ARCH_UNMAPPED_AREA
 unsigned long
-arch_get_unmapped_area(struct file *filp, unsigned long addr,
-		unsigned long len, unsigned long pgoff, unsigned long flags)
+generic_get_unmapped_area(struct file *filp, unsigned long addr,
+			  unsigned long len, unsigned long pgoff,
+			  unsigned long flags)
 {
 	struct mm_struct *mm = current->mm;
 	struct vm_area_struct *vma, *prev;
@@ -2169,17 +2169,25 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
 	info.align_offset = 0;
 	return vm_unmapped_area(&info);
 }
+
+#ifndef HAVE_ARCH_UNMAPPED_AREA
+unsigned long
+arch_get_unmapped_area(struct file *filp, unsigned long addr,
+		       unsigned long len, unsigned long pgoff,
+		       unsigned long flags)
+{
+	return generic_get_unmapped_area(filp, addr, len, pgoff, flags);
+}
 #endif
 
 /*
  * This mmap-allocator allocates new areas top-down from below the
  * stack's low limit (the base):
  */
-#ifndef HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
 unsigned long
-arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
-			  unsigned long len, unsigned long pgoff,
-			  unsigned long flags)
+generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
+				  unsigned long len, unsigned long pgoff,
+				  unsigned long flags)
 {
 	struct vm_area_struct *vma, *prev;
 	struct mm_struct *mm = current->mm;
@@ -2227,6 +2235,15 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
 
 	return addr;
 }
+
+#ifndef HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
+unsigned long
+arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
+			       unsigned long len, unsigned long pgoff,
+			       unsigned long flags)
+{
+	return generic_get_unmapped_area_topdown(filp, addr, len, pgoff, flags);
+}
 #endif
 
 unsigned long
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v9 3/4] mm: Add len and flags parameters to arch_get_mmap_end()
  2022-04-08  7:24 [PATCH v9 0/4] mm: Enable conversion of powerpc to default topdown mmap layout Christophe Leroy
  2022-04-08  7:24 ` [PATCH v9 1/4] mm: Allow arch specific arch_randomize_brk() with CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT Christophe Leroy
  2022-04-08  7:25 ` [PATCH v9 2/4] mm, hugetlbfs: Allow an arch to always use generic versions of get_unmapped_area functions Christophe Leroy
@ 2022-04-08  7:25 ` Christophe Leroy
  2022-04-08  7:25 ` [PATCH v9 4/4] mm, hugetlbfs: Allow for "high" userspace addresses Christophe Leroy
  2022-04-09  3:25 ` [PATCH v9 0/4] mm: Enable conversion of powerpc to default topdown mmap layout Andrew Morton
  4 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2022-04-08  7:25 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christophe Leroy, linux-kernel, linux-mm, linuxppc-dev,
	Steve Capper, Catalin Marinas, Will Deacon

Powerpc needs flags and len to make decision on arch_get_mmap_end().

So add them as parameters to arch_get_mmap_end().

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Steve Capper <steve.capper@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/include/asm/processor.h | 4 ++--
 mm/mmap.c                          | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index 73e38d9a540c..bd22d94e844d 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -92,8 +92,8 @@
 #endif /* CONFIG_COMPAT */
 
 #ifndef CONFIG_ARM64_FORCE_52BIT
-#define arch_get_mmap_end(addr) ((addr > DEFAULT_MAP_WINDOW) ? TASK_SIZE :\
-				DEFAULT_MAP_WINDOW)
+#define arch_get_mmap_end(addr, len, flags) \
+		(((addr) > DEFAULT_MAP_WINDOW) ? TASK_SIZE : DEFAULT_MAP_WINDOW)
 
 #define arch_get_mmap_base(addr, base) ((addr > DEFAULT_MAP_WINDOW) ? \
 					base + TASK_SIZE - DEFAULT_MAP_WINDOW :\
diff --git a/mm/mmap.c b/mm/mmap.c
index 08b40a9715ee..4d63e1cb3b52 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2118,7 +2118,7 @@ unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info)
 }
 
 #ifndef arch_get_mmap_end
-#define arch_get_mmap_end(addr)	(TASK_SIZE)
+#define arch_get_mmap_end(addr, len, flags)	(TASK_SIZE)
 #endif
 
 #ifndef arch_get_mmap_base
@@ -2144,7 +2144,7 @@ generic_get_unmapped_area(struct file *filp, unsigned long addr,
 	struct mm_struct *mm = current->mm;
 	struct vm_area_struct *vma, *prev;
 	struct vm_unmapped_area_info info;
-	const unsigned long mmap_end = arch_get_mmap_end(addr);
+	const unsigned long mmap_end = arch_get_mmap_end(addr, len, flags);
 
 	if (len > mmap_end - mmap_min_addr)
 		return -ENOMEM;
@@ -2192,7 +2192,7 @@ generic_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
 	struct vm_area_struct *vma, *prev;
 	struct mm_struct *mm = current->mm;
 	struct vm_unmapped_area_info info;
-	const unsigned long mmap_end = arch_get_mmap_end(addr);
+	const unsigned long mmap_end = arch_get_mmap_end(addr, len, flags);
 
 	/* requested length too big for entire address space */
 	if (len > mmap_end - mmap_min_addr)
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v9 4/4] mm, hugetlbfs: Allow for "high" userspace addresses
  2022-04-08  7:24 [PATCH v9 0/4] mm: Enable conversion of powerpc to default topdown mmap layout Christophe Leroy
                   ` (2 preceding siblings ...)
  2022-04-08  7:25 ` [PATCH v9 3/4] mm: Add len and flags parameters to arch_get_mmap_end() Christophe Leroy
@ 2022-04-08  7:25 ` Christophe Leroy
  2022-04-09  3:25 ` [PATCH v9 0/4] mm: Enable conversion of powerpc to default topdown mmap layout Andrew Morton
  4 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2022-04-08  7:25 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christophe Leroy, linux-kernel, linux-mm, linuxppc-dev,
	Steve Capper, Will Deacon, Catalin Marinas, stable

This is a complement of f6795053dac8 ("mm: mmap: Allow for "high"
userspace addresses") for hugetlb.

This patch adds support for "high" userspace addresses that are
optionally supported on the system and have to be requested via a hint
mechanism ("high" addr parameter to mmap).

Architectures such as powerpc and x86 achieve this by making changes to
their architectural versions of hugetlb_get_unmapped_area() function.
However, arm64 uses the generic version of that function.

So take into account arch_get_mmap_base() and arch_get_mmap_end() in
hugetlb_get_unmapped_area(). To allow that, move those two macros
out of mm/mmap.c into include/linux/sched/mm.h

If these macros are not defined in architectural code then they default
to (TASK_SIZE) and (base) so should not introduce any behavioural
changes to architectures that do not define them.

For the time being, only ARM64 is affected by this change.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Steve Capper <steve.capper@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Fixes: f6795053dac8 ("mm: mmap: Allow for "high" userspace addresses")
Cc: <stable@vger.kernel.org> # 5.0.x
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
---
 fs/hugetlbfs/inode.c     | 9 +++++----
 include/linux/sched/mm.h | 8 ++++++++
 mm/mmap.c                | 8 --------
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 09c8313ee1c4..6f863497bd69 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -205,7 +205,7 @@ hugetlb_get_unmapped_area_bottomup(struct file *file, unsigned long addr,
 	info.flags = 0;
 	info.length = len;
 	info.low_limit = current->mm->mmap_base;
-	info.high_limit = TASK_SIZE;
+	info.high_limit = arch_get_mmap_end(addr, len, flags);
 	info.align_mask = PAGE_MASK & ~huge_page_mask(h);
 	info.align_offset = 0;
 	return vm_unmapped_area(&info);
@@ -221,7 +221,7 @@ hugetlb_get_unmapped_area_topdown(struct file *file, unsigned long addr,
 	info.flags = VM_UNMAPPED_AREA_TOPDOWN;
 	info.length = len;
 	info.low_limit = max(PAGE_SIZE, mmap_min_addr);
-	info.high_limit = current->mm->mmap_base;
+	info.high_limit = arch_get_mmap_base(addr, current->mm->mmap_base);
 	info.align_mask = PAGE_MASK & ~huge_page_mask(h);
 	info.align_offset = 0;
 	addr = vm_unmapped_area(&info);
@@ -236,7 +236,7 @@ hugetlb_get_unmapped_area_topdown(struct file *file, unsigned long addr,
 		VM_BUG_ON(addr != -ENOMEM);
 		info.flags = 0;
 		info.low_limit = current->mm->mmap_base;
-		info.high_limit = TASK_SIZE;
+		info.high_limit = arch_get_mmap_end(addr, len, flags);
 		addr = vm_unmapped_area(&info);
 	}
 
@@ -251,6 +251,7 @@ generic_hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
 	struct mm_struct *mm = current->mm;
 	struct vm_area_struct *vma;
 	struct hstate *h = hstate_file(file);
+	const unsigned long mmap_end = arch_get_mmap_end(addr, len, flags);
 
 	if (len & ~huge_page_mask(h))
 		return -EINVAL;
@@ -266,7 +267,7 @@ generic_hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
 	if (addr) {
 		addr = ALIGN(addr, huge_page_size(h));
 		vma = find_vma(mm, addr);
-		if (TASK_SIZE - len >= addr &&
+		if (mmap_end - len >= addr &&
 		    (!vma || addr + len <= vm_start_gap(vma)))
 			return addr;
 	}
diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
index 18b2d2b2e0ca..8cd975a8bfeb 100644
--- a/include/linux/sched/mm.h
+++ b/include/linux/sched/mm.h
@@ -136,6 +136,14 @@ static inline void mm_update_next_owner(struct mm_struct *mm)
 #endif /* CONFIG_MEMCG */
 
 #ifdef CONFIG_MMU
+#ifndef arch_get_mmap_end
+#define arch_get_mmap_end(addr, len, flags)	(TASK_SIZE)
+#endif
+
+#ifndef arch_get_mmap_base
+#define arch_get_mmap_base(addr, base) (base)
+#endif
+
 extern void arch_pick_mmap_layout(struct mm_struct *mm,
 				  struct rlimit *rlim_stack);
 extern unsigned long
diff --git a/mm/mmap.c b/mm/mmap.c
index 4d63e1cb3b52..e9b7d74e58bc 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2117,14 +2117,6 @@ unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info)
 	return addr;
 }
 
-#ifndef arch_get_mmap_end
-#define arch_get_mmap_end(addr, len, flags)	(TASK_SIZE)
-#endif
-
-#ifndef arch_get_mmap_base
-#define arch_get_mmap_base(addr, base) (base)
-#endif
-
 /* Get an address range which is currently unmapped.
  * For shmat() with addr=0.
  *
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v9 0/4] mm: Enable conversion of powerpc to default topdown mmap layout
  2022-04-08  7:24 [PATCH v9 0/4] mm: Enable conversion of powerpc to default topdown mmap layout Christophe Leroy
                   ` (3 preceding siblings ...)
  2022-04-08  7:25 ` [PATCH v9 4/4] mm, hugetlbfs: Allow for "high" userspace addresses Christophe Leroy
@ 2022-04-09  3:25 ` Andrew Morton
  2022-04-09 10:16   ` Christophe Leroy
  4 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2022-04-09  3:25 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: linux-kernel, linux-mm, linuxppc-dev

On Fri,  8 Apr 2022 09:24:58 +0200 Christophe Leroy <christophe.leroy@csgroup.eu> wrote:

> Rebased on top of Linux 5.18-rc1
> 
> This is the mm part of the series that converts powerpc to default
> topdown mmap layout, for merge into v5.18

We're at 5.18-rc1.  The 5.18 merge window has closed and we're in
fixes-only mode.

If there's a case to be made that these patches are needed by 5.18
users then please let's make that case.  Otherwise, this is 5.19-rc1 material.

And if it is indeed all 5.19-rc1 material, then please carry all four
in the powerpc tree with Acked-by: Andrew Morton
<akpm@linux-foundation.org>.

Also, [4/4] has a cc:stable.  This is a bit odd because -stable
candidates should be standalone patches, staged ahead of all
for-next-merge-window material, so we can get them merged up quickly.

More oddly, [4/4]'s changelog provides no explanation for why the patch
should be considered for backporting.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v9 0/4] mm: Enable conversion of powerpc to default topdown mmap layout
  2022-04-09  3:25 ` [PATCH v9 0/4] mm: Enable conversion of powerpc to default topdown mmap layout Andrew Morton
@ 2022-04-09 10:16   ` Christophe Leroy
  2022-04-09 12:45     ` Michael Ellerman
  0 siblings, 1 reply; 8+ messages in thread
From: Christophe Leroy @ 2022-04-09 10:16 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-mm, linuxppc-dev



Le 09/04/2022 à 05:25, Andrew Morton a écrit :
> On Fri,  8 Apr 2022 09:24:58 +0200 Christophe Leroy <christophe.leroy@csgroup.eu> wrote:
> 
>> Rebased on top of Linux 5.18-rc1
>>
>> This is the mm part of the series that converts powerpc to default
>> topdown mmap layout, for merge into v5.18
> 
> We're at 5.18-rc1.  The 5.18 merge window has closed and we're in
> fixes-only mode.

Umm ... There must have been a misunderstanding then.

I contacted you before the merge window, and your answer was:

Le 11/03/2022 à 05:49, Andrew Morton a écrit :
>
> 5.18 isn't a problem.  Perhaps you meant 5.17, which would be real tough.
>
> Can we take a look after 5.18-rc1?


> 
> If there's a case to be made that these patches are needed by 5.18
> users then please let's make that case.  Otherwise, this is 5.19-rc1 material.

It's not really needed for 5.18. The idea was to merge that common part 
in 5.18 in order to minimise risks on conflicts. As far as I understand 
it often happens that changes of that kind get merged at the very end of 
the merge window or between rc1 and rc2. I was therefore not surprised 
that you offered to handle it past rc1.

History at:
https://patchwork.ozlabs.org/project/linuxppc-dev/cover/cover.1646847561.git.christophe.leroy@csgroup.eu/#2856080


> 
> And if it is indeed all 5.19-rc1 material, then please carry all four
> in the powerpc tree with Acked-by: Andrew Morton
> <akpm@linux-foundation.org>.

Well, Michael was a bit unconfortable with doing it that way, see below:


Le 11/03/2022 à 05:26, Michael Ellerman a écrit :
 >
 > Yeah I didn't pick it up because the mm changes don't have many acks and
 > I'm always nervous about carrying generic mm changes.
 >
 > It would be my preference if Andrew could take 2-5 through mm for v5.18,
 > but it is quite late, so I'm not sure how he will feel about that.
 >
 > Arguably 2, 3, 4 do very little. It's only patch 5 that has much effect,
 > and it has a reviewed-by from Catalin at least.

Michael, is it now ok for you to merge it via powerpc tree with Andrew's 
Ack ?

> 
> Also, [4/4] has a cc:stable.  This is a bit odd because -stable
> candidates should be standalone patches, staged ahead of all
> for-next-merge-window material, so we can get them merged up quickly.
> 
> More oddly, [4/4]'s changelog provides no explanation for why the patch
> should be considered for backporting.
> 

That was a request from Catalin from ARM64:

Le 04/01/2022 à 17:21, Catalin Marinas a écrit :
 > I wonder whether we should add a fixes tag (or at least the cc stable):
 >
 > Fixes: f6795053dac8 ("mm: mmap: Allow for "high" userspace addresses")
 > Cc: <stable@vger.kernel.org> # 5.0.x
 >
 > I think the original commit should have changed
 > hugetlb_get_unmapped_area() to have the same behaviour as
 > arch_get_unmapped_area(). Steve, any thoughts?
 >
 > FWIW,
 >
 > Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

 From 
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/db238c1ca2d46e33c57328f8d450f2563e92f8c2.1639736449.git.christophe.leroy@csgroup.eu/

I can try and see whether this can be moved in front of the other patches.

Thanks
Christophe

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v9 0/4] mm: Enable conversion of powerpc to default topdown mmap layout
  2022-04-09 10:16   ` Christophe Leroy
@ 2022-04-09 12:45     ` Michael Ellerman
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2022-04-09 12:45 UTC (permalink / raw)
  To: Christophe Leroy, Andrew Morton; +Cc: linux-kernel, linux-mm, linuxppc-dev

Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 09/04/2022 à 05:25, Andrew Morton a écrit :
>> On Fri,  8 Apr 2022 09:24:58 +0200 Christophe Leroy <christophe.leroy@csgroup.eu> wrote:
>> 
>>> Rebased on top of Linux 5.18-rc1
>>>
>>> This is the mm part of the series that converts powerpc to default
>>> topdown mmap layout, for merge into v5.18
>> 
>> We're at 5.18-rc1.  The 5.18 merge window has closed and we're in
>> fixes-only mode.
>
> Umm ... There must have been a misunderstanding then.

That's probably my fault for not getting back to Andrew.

> Le 11/03/2022 à 05:26, Michael Ellerman a écrit :
>  >
>  > Yeah I didn't pick it up because the mm changes don't have many acks and
>  > I'm always nervous about carrying generic mm changes.
>  >
>  > It would be my preference if Andrew could take 2-5 through mm for v5.18,
>  > but it is quite late, so I'm not sure how he will feel about that.
>  >
>  > Arguably 2, 3, 4 do very little. It's only patch 5 that has much effect,
>  > and it has a reviewed-by from Catalin at least.
>
> Michael, is it now ok for you to merge it via powerpc tree with Andrew's 
> Ack ?

Yes.

>> Also, [4/4] has a cc:stable.  This is a bit odd because -stable
>> candidates should be standalone patches, staged ahead of all
>> for-next-merge-window material, so we can get them merged up quickly.
>> 
>> More oddly, [4/4]'s changelog provides no explanation for why the patch
>> should be considered for backporting.
 
Yeah it's just a bit too politely worded :)

It says it's "a complement of f6795053dac8", but it's actually a fix for
a bug in that commit, that commit should have updated hugetlb behaviour.

> That was a request from Catalin from ARM64:
>
> Le 04/01/2022 à 17:21, Catalin Marinas a écrit :
>  > I wonder whether we should add a fixes tag (or at least the cc stable):
>  >
>  > Fixes: f6795053dac8 ("mm: mmap: Allow for "high" userspace addresses")
>  > Cc: <stable@vger.kernel.org> # 5.0.x
>  >
>  > I think the original commit should have changed
>  > hugetlb_get_unmapped_area() to have the same behaviour as
>  > arch_get_unmapped_area(). Steve, any thoughts?
>  >
>  > FWIW,
>  >
>  > Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
>
>  From 
> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/db238c1ca2d46e33c57328f8d450f2563e92f8c2.1639736449.git.christophe.leroy@csgroup.eu/
>
> I can try and see whether this can be moved in front of the other patches.

Thanks, that would be preferable.

cheers


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-04-09 12:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-08  7:24 [PATCH v9 0/4] mm: Enable conversion of powerpc to default topdown mmap layout Christophe Leroy
2022-04-08  7:24 ` [PATCH v9 1/4] mm: Allow arch specific arch_randomize_brk() with CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT Christophe Leroy
2022-04-08  7:25 ` [PATCH v9 2/4] mm, hugetlbfs: Allow an arch to always use generic versions of get_unmapped_area functions Christophe Leroy
2022-04-08  7:25 ` [PATCH v9 3/4] mm: Add len and flags parameters to arch_get_mmap_end() Christophe Leroy
2022-04-08  7:25 ` [PATCH v9 4/4] mm, hugetlbfs: Allow for "high" userspace addresses Christophe Leroy
2022-04-09  3:25 ` [PATCH v9 0/4] mm: Enable conversion of powerpc to default topdown mmap layout Andrew Morton
2022-04-09 10:16   ` Christophe Leroy
2022-04-09 12:45     ` Michael Ellerman

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).