Blame SOURCES/libhugetlbfs-2.16-map_high_truncate.patch

f1281f
commit f008e0d18a4ba8ac26b67c5989efde3406bce535
f1281f
Author: Jan Stancek <jstancek@redhat.com>
f1281f
Date:   Fri Dec 5 13:57:04 2014 +0100
f1281f
f1281f
    lower mmap size of map_high_truncate_2 on 32bit s390
f1281f
    
f1281f
    The low and high limit passed to vm_unmapped_area() in
f1281f
    hugetlb_get_unmapped_area() is (TASK_UNMAPPED_BASE, TASK_SIZE).
f1281f
    
f1281f
    On 64-bit kernel this is defined as:
f1281f
      #define TASK_UNMAPPED_BASE (test_thread_flag(TIF_31BIT) ? \
f1281f
                                 (1UL << 30) : (1UL << 41))
f1281f
      #define TASK_SIZE_OF(tsk)  ((tsk)->mm->context.asce_limit)
f1281f
    
f1281f
    For 32-bit (-m31) process, this can be as small as
f1281f
    (0x40000000, 0x80000000), which is 0x40000000 bytes long area.
f1281f
    This testcase however is trying to allocate 0x60000000 and fails:
f1281f
      FAIL mmap() 1: Cannot allocate memory
f1281f
    
f1281f
    Lower mmap size to ~0x20000000, which is more likely to suit
f1281f
    address space constraints of 32-bit s390.
f1281f
    
f1281f
    Signed-off-by: Jan Stancek <jstancek@redhat.com>
f1281f
    Signed-off-by: Eric B Munson <emunson@mgebm.net>
f1281f
f1281f
diff --git a/tests/map_high_truncate_2.c b/tests/map_high_truncate_2.c
f1281f
index daabd00..2a2560b 100644
f1281f
--- a/tests/map_high_truncate_2.c
f1281f
+++ b/tests/map_high_truncate_2.c
f1281f
@@ -50,7 +50,11 @@
f1281f
  * 856fc29505556cf263f3dcda2533cf3766c14ab6.
f1281f
  */
f1281f
 #define MAP_LENGTH	(4 * hpage_size)
f1281f
-#define TRUNCATE_POINT	0x60000000UL
f1281f
+#if defined(__s390__) && __WORDSIZE == 32
f1281f
+#define TRUNCATE_POINT 0x20000000UL
f1281f
+#else
f1281f
+#define TRUNCATE_POINT 0x60000000UL
f1281f
+#endif
f1281f
 #define HIGH_ADDR	0xa0000000UL
f1281f
 
f1281f
 int main(int argc, char *argv[])