Re: [RFC PATCH v2 2/2] Architecture defined limit on memory region random shift.

2018-03-23 Thread Ilya Smith

> On 22 Mar 2018, at 23:54, Andrew Morton  wrote:
> 
> 
> Please add changelogs.  An explanation of what a "limit on memory
> region random shift" is would be nice ;) Why does it exist, why are we
> doing this, etc.  Surely there's something to be said - at present this
> is just a lump of random code?
> 
> 
> 
Sorry, my bad. The main idea of this limit is to decrease possible memory 
fragmentation. This is not so big problem on 64bit process, but really big for 
32 bit processes since may cause failure memory allocation. To control memory 
fragmentation and protect 32 bit systems (or architectures) this limit was 
introduce by this patch. It could be also moved to CONFIG_ as well.
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [RFC PATCH v2 2/2] Architecture defined limit on memory region random shift.

2018-03-22 Thread Andrew Morton

Please add changelogs.  An explanation of what a "limit on memory
region random shift" is would be nice ;) Why does it exist, why are we
doing this, etc.  Surely there's something to be said - at present this
is just a lump of random code?




___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[RFC PATCH v2 2/2] Architecture defined limit on memory region random shift.

2018-03-22 Thread Ilya Smith
Signed-off-by: Ilya Smith 
---
 arch/alpha/kernel/osf_sys.c | 1 +
 arch/arc/mm/mmap.c  | 1 +
 arch/arm/mm/mmap.c  | 2 ++
 arch/frv/mm/elf-fdpic.c | 1 +
 arch/ia64/kernel/sys_ia64.c | 1 +
 arch/ia64/mm/hugetlbpage.c  | 1 +
 arch/metag/mm/hugetlbpage.c | 1 +
 arch/mips/mm/mmap.c | 1 +
 arch/parisc/kernel/sys_parisc.c | 2 ++
 arch/powerpc/mm/hugetlbpage-radix.c | 1 +
 arch/powerpc/mm/mmap.c  | 2 ++
 arch/powerpc/mm/slice.c | 2 ++
 arch/s390/mm/mmap.c | 2 ++
 arch/sh/mm/mmap.c   | 2 ++
 arch/sparc/kernel/sys_sparc_32.c| 1 +
 arch/sparc/kernel/sys_sparc_64.c| 2 ++
 arch/sparc/mm/hugetlbpage.c | 2 ++
 arch/tile/mm/hugetlbpage.c  | 2 ++
 arch/x86/kernel/sys_x86_64.c| 4 
 arch/x86/mm/hugetlbpage.c   | 4 
 fs/hugetlbfs/inode.c| 1 +
 include/linux/mm.h  | 1 +
 mm/mmap.c   | 3 ++-
 23 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index fa1a392..0ab9f31 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -1301,6 +1301,7 @@ arch_get_unmapped_area_1(unsigned long addr, unsigned 
long len,
info.high_limit = limit;
info.align_mask = 0;
info.align_offset = 0;
+   info.random_shift = 0;
return vm_unmapped_area();
 }
 
diff --git a/arch/arc/mm/mmap.c b/arch/arc/mm/mmap.c
index 2e13683..45225fc 100644
--- a/arch/arc/mm/mmap.c
+++ b/arch/arc/mm/mmap.c
@@ -75,5 +75,6 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
info.high_limit = TASK_SIZE;
info.align_mask = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0;
info.align_offset = pgoff << PAGE_SHIFT;
+   info.random_shift = 0;
return vm_unmapped_area();
 }
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index eb1de66..1eb660c 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -101,6 +101,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long 
addr,
info.high_limit = TASK_SIZE;
info.align_mask = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0;
info.align_offset = pgoff << PAGE_SHIFT;
+   info.random_shift = 0;
return vm_unmapped_area();
 }
 
@@ -152,6 +153,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const 
unsigned long addr0,
info.high_limit = mm->mmap_base;
info.align_mask = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0;
info.align_offset = pgoff << PAGE_SHIFT;
+   info.random_shift = 0;
addr = vm_unmapped_area();
 
/*
diff --git a/arch/frv/mm/elf-fdpic.c b/arch/frv/mm/elf-fdpic.c
index 46aa289..a2ce2ce 100644
--- a/arch/frv/mm/elf-fdpic.c
+++ b/arch/frv/mm/elf-fdpic.c
@@ -86,6 +86,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, 
unsigned long addr, unsi
info.high_limit = (current->mm->start_stack - 0x0020);
info.align_mask = 0;
info.align_offset = 0;
+   info.random_shift = 0;
addr = vm_unmapped_area();
if (!(addr & ~PAGE_MASK))
goto success;
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
index 085adfc..15fa4fb 100644
--- a/arch/ia64/kernel/sys_ia64.c
+++ b/arch/ia64/kernel/sys_ia64.c
@@ -64,6 +64,7 @@ arch_get_unmapped_area (struct file *filp, unsigned long 
addr, unsigned long len
info.high_limit = TASK_SIZE;
info.align_mask = align_mask;
info.align_offset = 0;
+   info.random_shift = 0;
return vm_unmapped_area();
 }
 
diff --git a/arch/ia64/mm/hugetlbpage.c b/arch/ia64/mm/hugetlbpage.c
index d16e419..ec7822d 100644
--- a/arch/ia64/mm/hugetlbpage.c
+++ b/arch/ia64/mm/hugetlbpage.c
@@ -162,6 +162,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, 
unsigned long addr, u
info.high_limit = HPAGE_REGION_BASE + RGN_MAP_LIMIT;
info.align_mask = PAGE_MASK & (HPAGE_SIZE - 1);
info.align_offset = 0;
+   info.random_shift = 0;
return vm_unmapped_area();
 }
 
diff --git a/arch/metag/mm/hugetlbpage.c b/arch/metag/mm/hugetlbpage.c
index 012ee4c..babd325 100644
--- a/arch/metag/mm/hugetlbpage.c
+++ b/arch/metag/mm/hugetlbpage.c
@@ -191,6 +191,7 @@ hugetlb_get_unmapped_area_new_pmd(unsigned long len)
info.high_limit = TASK_SIZE;
info.align_mask = PAGE_MASK & HUGEPT_MASK;
info.align_offset = 0;
+   info.random_shift = 0;
return vm_unmapped_area();
 }
 
diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
index 33d3251..5a3d384 100644
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
@@ -122,6 +122,7 @@ static unsigned long arch_get_unmapped_area_common(struct 
file *filp,
info.flags = 0;
info.low_limit = mm->mmap_base;
info.high_limit = TASK_SIZE;
+   info.random_shift = 0;
return