The low and high limit passed to vm_unmapped_area() in
hugetlb_get_unmapped_area() is (TASK_UNMAPPED_BASE, TASK_SIZE).

On 64-bit kernel this is defined as:
  #define TASK_UNMAPPED_BASE (test_thread_flag(TIF_31BIT) ? \
                             (1UL << 30) : (1UL << 41))
  #define TASK_SIZE_OF(tsk)  ((tsk)->mm->context.asce_limit)

For 32-bit (-m31) process, this can be as small as
(0x40000000, 0x80000000), which is 0x40000000 bytes long area.
This testcase however is trying to allocate 0x60000000 and fails:
  FAIL mmap() 1: Cannot allocate memory

Lower mmap size to ~0x20000000, which is more likely to suit
address space constraints of 32-bit s390.

Signed-off-by: Jan Stancek <[email protected]>
---
 tests/map_high_truncate_2.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/tests/map_high_truncate_2.c b/tests/map_high_truncate_2.c
index daabd00..2a2560b 100644
--- a/tests/map_high_truncate_2.c
+++ b/tests/map_high_truncate_2.c
@@ -50,7 +50,11 @@
  * 856fc29505556cf263f3dcda2533cf3766c14ab6.
  */
 #define MAP_LENGTH     (4 * hpage_size)
-#define TRUNCATE_POINT 0x60000000UL
+#if defined(__s390__) && __WORDSIZE == 32
+#define TRUNCATE_POINT 0x20000000UL
+#else
+#define TRUNCATE_POINT 0x60000000UL
+#endif
 #define HIGH_ADDR      0xa0000000UL
 
 int main(int argc, char *argv[])
-- 
1.7.1


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to