aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2013-09-10Cleanup ARM ld.hugetlbfs HTLB_LINK logicaarch64-tosendSteve Capper
When ld.hugetlbfs is executed with --hugetlbfs-link, there is code to check for the ARM platform and warn that this is not supported. There is also code to check for CUSTOM_LDSCRIPTS being false and give a similar warning. This patch removes the ARM check as the CUSTOM_LDSCRIPTS check will catch this. Signed-off-by: Steve Capper <steve.capper@linaro.org>
2013-09-10Add linkhuge_rw test to 64 bit && !CUSTOM_LDSCIPTSSteve Capper
If one compiles 64 bit with CUSTOM_LDSCRIPTS==no, then the linkhuge_rw test is not compiled even though the logic to build it exists. For 32 bit targets these tests are compiled. This patch adds $(HUGELINK_RW_TESTS) to the set of tests that are compiled for 64 bit in this case. Signed-off-by: Steve Capper <steve.capper@linaro.org>
2013-09-10Add PROT_NONE to the mprotect test.Steve Capper
The mprotect unit test checks PROT_READ and PROT_READ | PROT_WRITE protections. We recently found that PROT_NONE wasn't properly supported in an early version of our huge page kernel code. This patch adds PROT_NONE tests to mprotect. The expected behaviour is that neither reads nor writes should succeed. Signed-off-by: Steve Capper <steve.capper@linaro.org>
2013-09-10Aarch64 unit test fixes.Steve Capper
On Aarch64, zero bytes are illegal instructions, this is added to the icache-hygiene test. In mremap-expand-slice-collision, if __LP64__ is defined then mappings are attempted at 1TB boundaries which are outside the allowable mmap region for Aarch64. For __aarch64__ we change this mapping back to 256MB slices. Signed-off-by: Steve Capper <steve.capper@linaro.org>
2013-09-10Aarch64 support.Steve Capper
This patch adds support for Aarch64. As with ARMv7, We do not add the xBT/xBDT style linker scripts as these have been deprecated in favour of adjusting the page sizes via command line parameter to ld. Signed-off-by: Steve Capper <steve.capper@linaro.org>
2013-03-09Update NEWS file for 2.16 release2.16nextmasterEric B Munson
Signed-off-by: Eric B Munson <emunson@mgebm.net>
2013-03-09task-size-overrun: fix problem with dynamic pagetable upgrade on s390xGerald Schaefer
The strategy to find out TASK_SIZE won't work on s390x anymore, starting with kernel 3.9. We will dynamically increase the pagetable levels on s390x on access beyond TASK_SIZE, effectively increasing TASK_SIZE from 2^42 to 2^53, but /proc/self/maps won't reflect this. With the current strategy that means that find_task_size() would loop for a very long time, from 2^42 to 2^53. To fix this, increase addr in the loop for s390x as soon as we exceed the 2^42 limit. Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2013-03-03Terminate path with '\0' in find_mounts()Gerald Schaefer
commit 8c075e33 introduced a regression. The previous sscanf() implicitly did a null termination on path, while the new code misses the null termination. This can result in a failing hugetlbfs_test_path() and an error message like: "libhugetlbfs: WARNING: Hugepage size 1048576 unavailable" Reported-by: Vitaly Mayatskih <v.mayatskih@gmail.com> Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2013-02-23avoid calling munmap with zero lengthJan Stancek
mremap-fixed-huge-near-normal testcase mmaps 4*hpage_size - getpagesize() of anon shared memory. Then it finds area of 3 huge pages aligned to hpage_size and munmaps lower and upper areas: lower +----- 3*hpage_size -----+ upper / \/ \/ \ |--------|--------|--------|--------|--------| p q | p+xsize q+size If initial mmap will place whole area in such way, that lower or upper area size is zero, munmap fails with EINVAL and testcase fails. mmap(2): EINVAL (since Linux 2.6.12) length was 0. Signed-off-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Eric Munson <emunson@bert.(none)>
2013-02-23ARM unit test fix.Steve Capper
Supply some ARM signal handler code for icache-hygiene, and an ARM icache flush function. Signed-off-by: Steve Capper <steve.capper@arm.com> Signed-off-by: Eric Munson <emunson@bert.(none)>
2013-02-23ARM support.Steve Capper
This patch adds support for the ARM architecture to libhugetlbfs. We do not add the xBT/xBDT style linker scripts as these have been deprecated in favour of adjusting the page sizes via command line parameter to ld. Signed-off-by: Steve Capper <steve.capper@arm.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Eric Munson <emunson@bert.(none)>
2012-12-08Update NEWS file for 2.15 release2.15Eric B Munson
Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-12-07RE: [Libhugetlbfs-devel] update for clipped LD_LIBRARY_PATHdaniel.s.kokron@nasa.gov
This patch resolves clipped LD_LIBRARY_PATH. Using hugectl to enable use of hugepage for an application on a system with SLES11 SP1. hugectl was clipping my LD_LIBRARY_PATH at 254 characters and preventing execution. NAME_MAX on my platform is 255. This patch allows LD_LIBRARY_PATH to be up to 4096 characters on my platform. Signed-off-by: Daniel Kokron <Daniel.Kokron@nasa.gov> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-12-07Revert "exhaust malloc arenas before malloc tests"Eric B Munson
This reverts commit cdd2fa336d9980eb268a775b7cf9c49e3b698cd7. Conflicts: tests/hugetests.h tests/testutils.c With the removal of sscanf from the setup routines, the malloc tests now pass without having to exhaust small page allocations. Signed-off-by: Eric B Munson <emunson@mgebm.net> Cc: Jan Stancek <jstancek@redhat.com> Cc: Steve Capper <steve.capper@arm.com>
2012-12-07Remove use of sscanf in library setupEric B Munson
commit cdd2fa33 makes th library setup exhaust any heap allocated on small pages. This covers but does not address the cause of the allocation. As mentioned by Steve Capper, sscanf is the cause of the allocation. This patch removes the usage of sscanf from any function used in library setup prior to replacing _morecore. Signed-off-by: Eric B Munson <emunson@mgebm.net> Cc: Steve Capper <steve.capper@arm.com> Cc: Jan Stancek <jstancek@redhat.com>
2012-11-08Add --hugetlbfs-align linking support on s390Gerald Schaefer
This patch adds support for libhugetlbfs linking on s390 for binutils >= 2.17 with the --hugetlbfs-align option. No custom linker scripts are provided, so CUSTOM_LDSCRIPTS is set to "no" and the deprecated --hugetlbfs-link option is not supported on s390. Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-11-08Make custom linker scripts configurableGerald Schaefer
This patch introduces a CUSTOM_LDSCRIPTS variable in the Makefile as preparation for enabling libhugetlbfs linking on architectures w/o providing (deprecated) custom linker scripts. Setting it to "no" will prevent building and running the test cases requiring custom linker scripts, and issue an error message in ld.hugetlbfs when option --hugetlbfs-link is being used. It is set to "yes" by default for all architectures, which means no change to the current behaviour as far as "make" is concerned. A new option -l is added to run_tests.py, enabling the old-style linking tests. This means that the default for running run_tests.py directly is now changed to skip the old-style linking tests. Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-11-08Fix WARNING: Unable to verify address rangeGerald Schaefer
This patch fixes a warning about an empty address range that will be issued when the offset in prepare_segment() is smaller than page_size. In that case, check_range_empty() would be called with len == 0 (the page_size down-aligned offset), triggering the warning. This is fixed by checking the down-aligned offset instead of the offset itself before calling check_range_empty(). Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-11-06build 4G-edge testcases as -staticJan Stancek
huge_at_4GB_normal_below, huge_below_4GB_normal_above, straddle_4GB are tests to test corner cases on powerpc. powerpc manages memory using slices: low (0-4G) and high (4G-). These tests are using MAP_FIXED and try to mmap hugepage at various locations. Issue is that kernel or ld.so can already mmaped region that these tests want to use: # ./obj64/straddle_4GB Starting testcase "./obj64/straddle_4GB", pid 25949 Mapping without MAP_FIXED at ff000000...got 0xefffe000000 instead, never mind Mapping with MAP_FIXED at ff000000 FAIL mmap() FIXED failed: Device or resource busy Looking at mappings prior to failed mmap, there are already some libraries mapped to first high slice (0). Without patch: 10010000-10020000 r--p 00000000 fd:01 2893006 /root/libhugetlbfs/tests/obj64/straddle_4GB 10020000-10030000 rw-p 00010000 fd:01 2893006 /root/libhugetlbfs/tests/obj64/straddle_4GB 8015160000-8015190000 r-xp 00000000 fd:01 1857222 /usr/lib64/ld-2.15.so 8015190000-80151a0000 r--p 00020000 fd:01 1857222 /usr/lib64/ld-2.15.so 80151a0000-80151b0000 rw-p 00030000 fd:01 1857222 /usr/lib64/ld-2.15.so 80151d0000-8015390000 r-xp 00000000 fd:01 1857223 /usr/lib64/libc-2.15.so 8015390000-80153a0000 r--p 001b0000 fd:01 1857223 /usr/lib64/libc-2.15.so 80153a0000-80153c0000 rw-p 001c0000 fd:01 1857223 /usr/lib64/libc-2.15.so 80153c0000-80153e0000 r-xp 00000000 fd:01 1835789 /usr/lib64/libpthread-2.15.so 80153e0000-80153f0000 r--p 00010000 fd:01 1835789 /usr/lib64/libpthread-2.15.so 80153f0000-8015400000 rw-p 00020000 fd:01 1835789 /usr/lib64/libpthread-2.15.so 8015400000-8015410000 r-xp 00000000 fd:01 1842374 /usr/lib64/libdl-2.15.so 8015410000-8015420000 r--p 00000000 fd:01 1842374 /usr/lib64/libdl-2.15.so 8015420000-8015430000 rw-p 00010000 fd:01 1842374 /usr/lib64/libdl-2.15.so 10022e00000-10022e30000 rw-p 00000000 00:00 0 [heap] fff8e650000-fff8e670000 r-xp 00000000 fd:01 1837902 /usr/lib64/libhugetlbfs.so fff8e670000-fff8e680000 r--p 00010000 fd:01 1837902 /usr/lib64/libhugetlbfs.so fff8e680000-fff8e690000 rw-p 00020000 fd:01 1837902 /usr/lib64/libhugetlbfs.so fff8e690000-fff8e6a0000 r-xp 00000000 fd:01 1842940 /usr/lib64/libhugetlbfs_privutils.so fff8e6a0000-fff8e6b0000 r--p 00000000 fd:01 1842940 /usr/lib64/libhugetlbfs_privutils.so fff8e6b0000-fff8e6c0000 rw-p 00010000 fd:01 1842940 /usr/lib64/libhugetlbfs_privutils.so fff8e6c0000-fff8e6d0000 rw-p 00000000 00:00 0 fff8e6d0000-fff8e6f0000 r-xp 00000000 00:00 0 [vdso] fffc7110000-fffc7140000 rw-p 00000000 00:00 0 [stack] This patch builds 3 mentioned testcases as -static, which increases chances, that slices around 4GB boundary will be free. With patch: 10000000-100d0000 r-xp 00000000 fd:01 1966884 /root/libhugetlbfs/tests/obj64/straddle_4GB_static 100d0000-100f0000 rw-p 000c0000 fd:01 1966884 /root/libhugetlbfs/tests/obj64/straddle_4GB_static 100f0000-10100000 rw-p 00000000 00:00 0 10019550000-10019580000 rw-p 00000000 00:00 0 [heap] fffac380000-fffac390000 rw-p 00000000 00:00 0 fffac390000-fffac3b0000 r-xp 00000000 00:00 0 [vdso] fffdca10000-fffdca40000 rw-p 00000000 00:00 0 [stack] Signed-off-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-11-06fail test only when MAP_FIXED fails on free slicesJan Stancek
huge_at_4GB_normal_below, huge_below_4GB_normal_above, straddle_4GB are tests to test corner cases on powerpc. powerpc manages memory using slices: low (0-4G) and high (4G-). These tests are using MAP_FIXED and try to mmap hugepage at various locations. Issue is that kernel or ld.so can be already using region that these tests want to use. At the moment it ends with failure: # ./obj64/straddle_4GB Starting testcase "./obj64/straddle_4GB", pid 25949 Mapping without MAP_FIXED at ff000000...got 0xefffe000000 instead, never mind Mapping with MAP_FIXED at ff000000 FAIL mmap() FIXED failed: Device or resource busy Looking at mappings prior to failed mmap, there are already some libraries mapped to first high slice (0). 10010000-10020000 r--p 00000000 fd:01 2893006 /root/libhugetlbfs/tests/obj64/straddle_4GB 10020000-10030000 rw-p 00010000 fd:01 2893006 /root/libhugetlbfs/tests/obj64/straddle_4GB 8015160000-8015190000 r-xp 00000000 fd:01 1857222 /usr/lib64/ld-2.15.so 8015190000-80151a0000 r--p 00020000 fd:01 1857222 /usr/lib64/ld-2.15.so 80151a0000-80151b0000 rw-p 00030000 fd:01 1857222 /usr/lib64/ld-2.15.so 80151d0000-8015390000 r-xp 00000000 fd:01 1857223 /usr/lib64/libc-2.15.so 8015390000-80153a0000 r--p 001b0000 fd:01 1857223 /usr/lib64/libc-2.15.so 80153a0000-80153c0000 rw-p 001c0000 fd:01 1857223 /usr/lib64/libc-2.15.so 80153c0000-80153e0000 r-xp 00000000 fd:01 1835789 /usr/lib64/libpthread-2.15.so 80153e0000-80153f0000 r--p 00010000 fd:01 1835789 /usr/lib64/libpthread-2.15.so 80153f0000-8015400000 rw-p 00020000 fd:01 1835789 /usr/lib64/libpthread-2.15.so 8015400000-8015410000 r-xp 00000000 fd:01 1842374 /usr/lib64/libdl-2.15.so 8015410000-8015420000 r--p 00000000 fd:01 1842374 /usr/lib64/libdl-2.15.so 8015420000-8015430000 rw-p 00010000 fd:01 1842374 /usr/lib64/libdl-2.15.so 10022e00000-10022e30000 rw-p 00000000 00:00 0 [heap] fff8e650000-fff8e670000 r-xp 00000000 fd:01 1837902 /usr/lib64/libhugetlbfs.so fff8e670000-fff8e680000 r--p 00010000 fd:01 1837902 /usr/lib64/libhugetlbfs.so fff8e680000-fff8e690000 rw-p 00020000 fd:01 1837902 /usr/lib64/libhugetlbfs.so fff8e690000-fff8e6a0000 r-xp 00000000 fd:01 1842940 /usr/lib64/libhugetlbfs_privutils.so fff8e6a0000-fff8e6b0000 r--p 00000000 fd:01 1842940 /usr/lib64/libhugetlbfs_privutils.so fff8e6b0000-fff8e6c0000 rw-p 00010000 fd:01 1842940 /usr/lib64/libhugetlbfs_privutils.so fff8e6c0000-fff8e6d0000 rw-p 00000000 00:00 0 fff8e6d0000-fff8e6f0000 r-xp 00000000 00:00 0 [vdso] fffc7110000-fffc7140000 rw-p 00000000 00:00 0 [stack] This patch checks that slices used by tests are actually free (not mapped). If they are not free and mmap fails, test will PASS as inconclusive. Signed-off-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-11-06set slice boundary at runtimeJan Stancek
This testcase failed on some setups (ppc64): Starting testcase "./obj64/mremap-expand-slice-collision", pid 10840 do_readback(0x20001000000, 0x1000000, "huge above") do_readback(0x1ffffff0000, 0x10000, "normal below") Attempting to remap...disallowed do_readback(0x20001000000, 0x10000, "normal above") FAIL mmap(huge below): Device or resource busy Problem is that SLICE_BOUNDARY was hardcoded to 0x20000000000. When testcase tries to mmap huge page below this address (0x1ffff000000), it fails with EBUSY because there is already heap (0x1????000000) at this slice which may not be using huge pages. See also kernel commit. which introduced slices on powerpc: commit d0f13e3c20b6fb73ccb467bdca97fa7cf5a574cd Author: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: Tue May 8 16:27:27 2007 +1000 [POWERPC] Introduce address space "slices" This patch removes hardcoded SLICE_BOUNDARY address and introduces function to find two free neighbour slices at runtime. Slice boundary is then set to address between these slices. With patch: Starting testcase "./obj64/mremap-expand-slice-collision", pid 12768 can't use slice_boundary: 0x20000000000 using slice_boundary: 0x30000000000 do_readback(0x30001000000, 0x1000000, "huge above") do_readback(0x2ffffff0000, 0x10000, "normal below") Attempting to remap...disallowed do_readback(0x30001000000, 0x10000, "normal above") do_readback(0x2ffff000000, 0x1000000, "huge below") Attempting to remap...disallowed PASS Signed-off-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-11-06mremap can't extend shared anon memoryJan Stancek
mremap-expand-slice-collision mmaps page of shared anon memory, which is then passed to mremap to extend this mapping to two pages: mremap(q, page_size, 2*page_size, 0); The mapping is extended, but backing shmem file is not, so accessing second page always fails with SIGBUS in do_readback(). Signed-off-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-09-07Update NEWS for 2.14 release2.14Eric B Munson
Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-09-07limit core dumping for stack_grow_into_hugeJan Stancek
stack_grow_into_huge allocates large chunks on memory and do_child() will eventually fail with SIGSEGV. If system is set up to dump core, it can take significant time until this action is completed. For example if ABRT runs on such system, kernel is blocked on pipe_write for couple of minutes: # time ./obj64/stack_grow_into_huge Starting testcase "./obj64/stack_grow_into_huge", pid 24257 PASS real 29m12.060s user 0m0.013s sys 4m41.744s Sep 7 06:56:54 ibm-p720-01-lp3 abrt[24259]: Saved core dump of pid 24258 (/root/libhugetlbfs/tests/obj64/stack_grow_into_huge) to /var/spool/abrt/ccpp-2012-09-07-06:27:42-24258 (1098439983104 bytes) With patch: Starting testcase "./obj64/stack_grow_into_huge", pid 24384 PASS real 0m0.206s user 0m0.013s sys 0m0.193s Signed-off-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-09-07dont include base_size in fake hugepagesizesJan Stancek
What is fake on one platform can be actual page_size on some other platform. This testcase failed on ppc64 with 64K pagesize: gethugepagesizes (16M: 32): FAIL Line 397: Duplicate size 65536 at 0/2 gethugepagesizes (16M: 64): FAIL Line 397: Duplicate size 65536 at 0/2 Reason is that getpagesizes() adds pagesize to page sizes from gethugetpagesizes(). This testcase fakes sysfs data, so there is 64K hugepage size and then getpagesizes() adds base_size to that, which is also 64K. Signed-off-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-09-06exhaust malloc arenas before malloc testsJan Stancek
First allocation in malloc tests is just 1024 bytes. If there is enough free mem in malloc arenas, this first allocation can be satisfied without call to MORECORE() and testcase will fail. LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=yes malloc (2M: 64): FAIL Address is not hugepage When looking at output from HUGETLB_DEBUG=1 it appears that hook to __morecore doesn't work as there is no trace from hugetlbfs_morecore. This patch will keep malloc-ing 1-byte chunks of memory as long as it comes from '[heap]' or maximum is reached. This will force glibc to call MORECORE() before actual malloc/malloc_manysmall test begins. Signed-off-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-09-06ignore return value from readahead()Jan Stancek
do_readahead() requires a_ops->readpage to be != NULL: 568 static ssize_t 569 do_readahead(struct address_space *mapping, struct file *filp, 570 pgoff_t index, unsigned long nr) 571 { 572 if (!mapping || !mapping->a_ops || !mapping->a_ops->readpage) 573 return -EINVAL; 574 575 force_page_cache_readahead(mapping, filp, index, nr); 576 return 0; 577 } but following commit removed readpage from hugetlbfs: commit f2deae9d4e70793568ef9e85d227abb7bef5b622 Author: Mel Gorman <mel@csn.ul.ie> Date: Wed May 13 15:56:10 2009 +0100 Remove implementation of readpage from the hugetlbfs_aops So this is going to always return EINVAL on patched kernels. Ignore return value, regardless of readahead() outcome testcase will still check if reservation counter gets corrupted. Signed-off-by: Jan Stancek <jstancek@redhat.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-03-22Decrement index before closing files on error exitEric B Munson
If obtain_prepared_file fails for any reason, the last fd in our hugetlb segment table will be 0 when the error clean up starts because obtain_prepared_file does not write to the segment structure in error cases. Because the cleanup for loop starts at the segment where obtain_prepared_file failed it will try to close stdout (fd 0). This patch makes the cleanup for loop decrement the index before starting to close file descriptors. Reported-by: Dan Scales <scales@vmware.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-03-22oprofile_map_events: Add basic events for i386/core_i7Mel Gorman
Map profile events for the i386/core_i7 and add a sensible default for i386 in general. Signed-off-by: Mel Gorman <mgorman@suse.de> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-03-10Update man pagesAndrew Hastings
Add missing man pages for ld.hugetlbfs.1, hugetlbfs_find_path.3, hugetlbfs_find_path_for_size.3, gethugepagesize.3, hugetlbfs_test_path.3, hugetlbfs_unlinked_fd.3, and hugetlbfs_unlinked_fd_for_size.3. Add cross references to the new man pages. Fix some typos in gethugepagesizes.3, getpagesizes.3, and libhugetlbfs.7. Document HUGETLB_DEFAULT_PAGE_SIZE. Signed-off-by: Andrew Hastings <abh@cray.com> on behalf of Cray Inc. Signed-off-by: Eric B Munson <emunson@mgebm.net>
2012-03-05Update NEWS file for 2.13 release2.13Eric B Munson
Signed-off-by: Eric B Munson <emunson@mgebm.net>
2011-12-15Check permissions when selecting mountEric B Munson
Currently the library will select the first hugetlbfs mount it finds for a given page size for usage. This can lead to frustrating failures when root owns the first mount and a user has a later mount in the list. This patch makes find_mounts check if a given mount is usable by the current user. Mounts that are not usable will be skipped. Signed-off-by: Eric B Munson <emunson@mgebm.net> Cc: Andrew Lutomirski <luto@mit.edu> Cc: David Gibson <david@gibson.dropbear.id.au>
2011-12-15Add controls to hugectl for new THP related env variablesEric B Munson
This patch adds controls for the new THP related functionality in the library. Signed-off-by: Eric B Munson <emunson@mgebm.net> Acked-by: Andrew Hastings <abh@cray.com> Cc: abh@cray.com Cc: daivd@gibson.dropbear.id.au
2011-12-15Add support to hugeadm for configuring transparent huge pagesEric B Munson
Transparent huge pages (THP) have two tunables in sysfs used to control the behavior of khugepaged. This patch adds the support for controlling these tunables via hugeadm options. Signed-off-by: Eric B Munson <emunson@mgebm.net> Acked-by: Andrew Hastings <abh@cray.com> Cc: abh@cray.com Cc: daivd@gibson.dropbear.id.au
2011-12-15Add support for THP in morecoreEric B Munson
Transparent huge pages (THP) give another option for access to huge pages for anonymous mappings. This patch adds the ability to specify that the process heap should be aligned and (if requested madvised) to be merged into huge pages by khugepaged. For more information on THP see linux-2.6/Documentation/transhuge.txt. Signed-off-by: Eric B Munson <emunson@mgebm.net> Cc: abh@cray.com Cc: daivd@gibson.dropbear.id.au
2011-12-07Replace fixed address shm attachment by an random oneBill Carson
Original fixed address at 0x80000000 will fail when calling shmat on ARM. Use the address system provide for us will prevent this failure. Moreover, add cleanup when shmat failed to release reserved huge pages otherwise paranoid pool check will fail on this. Signed-off-by: Bill Carson <bill4carson@gmail.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2011-09-08Fix dependecies for Makefile to fix parallel buildMatthew McClintock
Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Eric B Munson <emunson@mgebm.net>
2011-05-26Make calls to strcmp in hugetlb_env_setup consistentEric B Munson
String comparison in hugetlb_setup_env is done in an inconsisten way. This is a problem because some of the environment variables are checked ignoring case where others are case sensitive. This patch converts all of the comparisons looking for boolean (yes/no) values to ignore case. Signed-off-by: Eric B Munson <emunson@mgebm.net> Acked-by: David Gibson <david@gibson.dropbear.id.au>
2011-04-01Update NEWS file for 2.12 release2.12Eric B Munson
Signed-off-by: Eric B Munson <emunson@mgebm.net>
2011-03-30Make mount point names more human readableEric B Munson
When hugeadm creates mount points currently the pagesize is used in bytes. This is not very human readable as page sizes grow. This patch changes the mount point creation to use points labeled in a more readable fashion. For instance 2MB instead of 2097152. Signed-off-by: Eric B Munson <emunson@mgebm.net>
2011-02-23Allow actions to be restricted to certain programsAndrew Hastings
By default, libhugetlbfs will act on any program that it is loaded with, either via LD_PRELOAD or by explicitly linking with -lhugetlbfs. There are situations in which it is desirable to restrict libhugetlbfs' actions to specific programs. For example, some ISV applications are wrapped in a series of scripts that invoke bash, python, and/or perl. It is more convenient to set the environment variables related to libhugetlbfs outside of the wrapper scripts, yet this has the unintended and undesirable consequence of causing the script interpreters to use and consume hugepages. Often there is no obvious benefit to causing the script interpreters to use hugepages, and there is a clear disadvantage: fewer hugepages are available to the actual application. To address this scenario, add a HUGETLB_RESTRICT_EXE environment variable. If this variable is set, libhugetlbfs will restrict its actions to only those programs named in HUGETLB_RESTRICT_EXE. (If not set, libhugetlbfs will attempt to apply the requested actions to all programs.) For example, HUGETLB_RESTRICT_EXE="hpcc:long_hpcc" will restrict libhugetlbfs' actions to programs named /home/fred/hpcc and /bench/long_hpcc but will not affect /usr/bin/hpcc_no. Based on a patch originally authored by Dean Luick <luick@cray.com>. Signed-off-by: Andrew Hastings <abh@cray.com> on behalf of Cray Inc. Signed-off-by: Eric B Munson <emunson@mgebm.net>
2011-02-23tests: add support for static linkingAndrew Hastings
Add general support for static linking to the test suite. Build a static version of the shmoverride_linked test; this acts as a test case for a recent patch that allows shmget() to be used in static executables linked against libhugetlbfs. Correct runtests.py to run all cases of shmoverride: with and without LD_PRELOAD, with and without HUGETLB_SHM, with and without prelinking. Signed-off-by: Andrew Hastings <abh@cray.com> on behalf of Cray Inc. Signed-off-by: Eric B Munson <emunson@mgebm.net>
2011-02-23hugeadm.c: Don't segfault if user not in passwd fileAndrew Hastings
If a user somehow managed to run hugeadm without an entry being present for the user in the passwd file, hugeadm was segfaulting because it did not check for failure of getpwuid(). Fix: check for getpwuid() failure and issue an appropriate error message. Based on a patch originally authored by Dean Luick <luick@cray.com>. Signed-off-by: Andrew Hastings <abh@cray.com> on behalf of Cray Inc. Signed-off-by: Eric B Munson <emunson@mgebm.net>
2011-01-21Store return value of ftruncate in icache-hygieneEric B Munson
When warn_unused_result is enabled there are several warnings about ignored return values of ftruncate in the icache-hygiene test. This patch contiunues to ignore the return value but stores it to quiet the compiler. Signed-off-by: Eric B Munson <emunson@mgebm.net>
2011-01-21shm.c: Allow static linking with shmget()Andrew Hastings
libhugetlbfs redefines shmget() so that it can transparently optionally add the hugepage flag. Unfortunately, it uses dlsym() to to find the next shmget() to call in the dynamic library call chain. This does not work on statically-linked executables. Work around this by making all references to libdl weak, and testing for its presence. If libdl symbols are not not present, directly make the shmget syscall. Making the dl* symbols weak does not affect dynamic executables as libdl.so is: * Automatically added to the library dependency list when liked with -lhugetlbfs * Mapped into the programs address space when used with LD_PRELOAD. Based on a patch originally authored by Dean Luick <luick@cray.com>. Signed-off-by: Andrew Hastings <abh@cray.com> on behalf of Cray Inc. Signed-off-by: Eric B Munson <emunson@mgebm.net>
2011-01-21tests/Makefile: add missing testsAndrew Hastings
Fix the libhugetlbfs test Makefile so the built-in test suite can correctly install and run the tests. - Several tests that require a wrapper are not in the general list of tests. They must be listed there for the wrapper Makefile code to operate correctly. - The test driver is now a python script, but the installer was still looking for a differently named bash script. Patch originally authored by Dean Luick <luick@cray.com>. Signed-off-by: Andrew Hastings <abh@cray.com> on behalf of Cray Inc. Signed-off-by: Eric B Munson <emunson@mgebm.net>
2011-01-21probe_default_hpage_size(): add newlineAndrew Hastings
An error message in probe_default_hpage_size is missing a newline. Signed-off-by: Andrew Hastings <abh@cray.com> on behalf of Cray Inc. Signed-off-by: Eric B Munson <emunson@mgebm.net>
2010-12-16Update NEWS file for 2.11 release2.11Eric B Munson
Signed-off-by: Eric B Munson <emunson@mgebm.net>
2010-12-16Fix error value handling in get_huge_pagesEric B Munson
hugetlbfs_prefault returns an error value instead of setting errno so we need to us the value returned for strerror instead of errno. Signed-off-by: Eric B Munson <emunson@mgebm.net>
2010-12-16Remove unused global zero_fdEric B Munson
Now that hugetlbfs_prefault no longer takes an fd argument, there is no reason to keep the global zero_fd around. Signed-off-by: Eric B Munson <emunson@mgebm.net>