All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/mmap: Define DEFAULT_STACK_GUARD_GAP
@ 2023-08-28  3:52 Anshuman Khandual
  2023-08-29 12:32 ` Matthew Wilcox
  0 siblings, 1 reply; 4+ messages in thread
From: Anshuman Khandual @ 2023-08-28  3:52 UTC (permalink / raw)
  To: linux-mm; +Cc: Anshuman Khandual, Andrew Morton, linux-kernel

This just defines a macro constant i.e DEFAULT_STACK_GUARD_GAP representing
the default gap, guarding the stack mapping. This does not cause functional
changes.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 include/linux/mman.h | 3 +++
 mm/mmap.c            | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/mman.h b/include/linux/mman.h
index cee1e4b566d8..cbcd20a071c0 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -8,6 +8,9 @@
 #include <linux/atomic.h>
 #include <uapi/linux/mman.h>
 
+/* Default gap for stack mapping is 256 pages */
+#define DEFAULT_STACK_GUARD_GAP (256UL << PAGE_SHIFT)
+
 /*
  * Arrange for legacy / undefined architecture specific flags to be
  * ignored by mmap handling code.
diff --git a/mm/mmap.c b/mm/mmap.c
index 3937479d0e07..8679750333bb 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2120,7 +2120,7 @@ int expand_downwards(struct vm_area_struct *vma, unsigned long address)
 }
 
 /* enforced gap between the expanding stack and other mappings. */
-unsigned long stack_guard_gap = 256UL<<PAGE_SHIFT;
+unsigned long stack_guard_gap = DEFAULT_STACK_GUARD_GAP;
 
 static int __init cmdline_parse_stack_guard_gap(char *p)
 {
-- 
2.30.2


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

* Re: [PATCH] mm/mmap: Define DEFAULT_STACK_GUARD_GAP
  2023-08-28  3:52 [PATCH] mm/mmap: Define DEFAULT_STACK_GUARD_GAP Anshuman Khandual
@ 2023-08-29 12:32 ` Matthew Wilcox
  2023-08-30  2:55   ` Anshuman Khandual
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2023-08-29 12:32 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: linux-mm, Andrew Morton, linux-kernel

On Mon, Aug 28, 2023 at 09:22:48AM +0530, Anshuman Khandual wrote:
> This just defines a macro constant i.e DEFAULT_STACK_GUARD_GAP representing
> the default gap, guarding the stack mapping. This does not cause functional
> changes.

But why have you done it at all?

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

* Re: [PATCH] mm/mmap: Define DEFAULT_STACK_GUARD_GAP
  2023-08-29 12:32 ` Matthew Wilcox
@ 2023-08-30  2:55   ` Anshuman Khandual
  2023-08-30  3:24     ` Matthew Wilcox
  0 siblings, 1 reply; 4+ messages in thread
From: Anshuman Khandual @ 2023-08-30  2:55 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: linux-mm, Andrew Morton, linux-kernel



On 8/29/23 18:02, Matthew Wilcox wrote:
> On Mon, Aug 28, 2023 at 09:22:48AM +0530, Anshuman Khandual wrote:
>> This just defines a macro constant i.e DEFAULT_STACK_GUARD_GAP representing
>> the default gap, guarding the stack mapping. This does not cause functional
>> changes.
> 
> But why have you done it at all?

Just as a normal cleanup which also improves readability.

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

* Re: [PATCH] mm/mmap: Define DEFAULT_STACK_GUARD_GAP
  2023-08-30  2:55   ` Anshuman Khandual
@ 2023-08-30  3:24     ` Matthew Wilcox
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Wilcox @ 2023-08-30  3:24 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: linux-mm, Andrew Morton, linux-kernel

On Wed, Aug 30, 2023 at 08:25:45AM +0530, Anshuman Khandual wrote:
> 
> 
> On 8/29/23 18:02, Matthew Wilcox wrote:
> > On Mon, Aug 28, 2023 at 09:22:48AM +0530, Anshuman Khandual wrote:
> >> This just defines a macro constant i.e DEFAULT_STACK_GUARD_GAP representing
> >> the default gap, guarding the stack mapping. This does not cause functional
> >> changes.
> > 
> > But why have you done it at all?
> 
> Just as a normal cleanup which also improves readability.

hard disagree.  NAK this patch.

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

end of thread, other threads:[~2023-08-30  3:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-28  3:52 [PATCH] mm/mmap: Define DEFAULT_STACK_GUARD_GAP Anshuman Khandual
2023-08-29 12:32 ` Matthew Wilcox
2023-08-30  2:55   ` Anshuman Khandual
2023-08-30  3:24     ` Matthew Wilcox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.