[This version includes feedback from Adam. It includes fixes to ensure hugeadm will only list page sizes which are available for use, ie. have mounted filesystems. It also handles failure to expand the pool.]
Currently the admin has to understand how to configure pools directly. They must know how to find the current pool allocations, and how to manipulate them; which change from kernel level to kernel level and may even differ from one pool size to another. They must know how to mount filesystems to expose those pools and where there are more than one filesystem of a pariticular size they must know how to ensure the underlying pools are sizes appropriatly. It is into this void we hope to place hugeadm. The underlying plan is that there should be one application which would simplify control of the managment of huge pages. That the admin would be able to say things like "I need 10 more 16MB pages", or even "make me a 16MB page backed filesystem with 10 pages for oracle to use, and another for the batch sytem with between 10 and 20 pages" and the pools would be resized as required and appropraite filesystems would be created. Obviously at this point we are only at the foundation building phase, this first step concentrates on page sizes and pool configuration. For page sizes it is possible to query both the currently available and all supported page sizes. It exposes the pool configuration in a simple to understand form and allows the admin to manipulate the pool sizes, both in terms of static and overcommit pages. This is both useful directly for a more knowledgable admin and provides the interfaces needed for later functionality. Page sizes are (currently) exposed in two different ways, via a new pagesize utility which produces a simple list of sizes: [EMAIL PROTECTED] ./obj/pagesize 4096 [EMAIL PROTECTED] ./obj/pagesize -a 4096 65536 2097152 16777216 [EMAIL PROTECTED] ./obj/pagesize -H 65536 2097152 16777216 Also it is still exposed via hugeadm, this differs in that the sizes listed here are those with a working mountpoint as well as pages: [EMAIL PROTECTED] ./obj/hugeadm --page-sizes 65536 2097152 [EMAIL PROTECTED] ./obj/hugeadm --page-sizes-all 65536 2097152 16777216 The pool is exposed as a simple table. This represents the static allocation (Minimum), the current actual alloction which includes any overcommit pages in use (Current), and the total pages which may be allocated including any overcommit (Maximum): [EMAIL PROTECTED] ./obj/hpoolcfg --pool-list Size Minimum Current Maximum Default 65536 0 0 0 2097152 4 4 4 * 16777216 0 0 0 Pool manipulation is exposed as both abolute and relative updates to the virtual Minimum and Maximum exposed above: [EMAIL PROTECTED] ./obj/hugeadm --pool-pages-min 64k:10 [EMAIL PROTECTED] ./obj/hpoolcfg --pool-list Size Minimum Current Maximum Default 65536 10 10 10 2097152 4 4 4 * 16777216 0 0 0 [EMAIL PROTECTED] ./obj/hugeadm --pool-pages-max 64k:20 [EMAIL PROTECTED] ./obj/hpoolcfg --pool-list Size Minimum Current Maximum Default 65536 10 10 20 2097152 4 4 4 * 16777216 0 0 0 Moving one boundary through the other will push that boundary with it: [EMAIL PROTECTED] ./obj/hugeadm --pool-pages-max 64k:5 [EMAIL PROTECTED] ./obj/hpoolcfg --pool-list Size Minimum Current Maximum Default 65536 5 5 5 2097152 4 4 4 * 16777216 0 0 0 They may also be adjusted with relative deltas: [EMAIL PROTECTED] ./obj/hugeadm --pool-pages-max 64k:+5 [EMAIL PROTECTED] ./obj/hpoolcfg --pool-list Size Minimum Current Maximum Default 65536 5 5 10 2097152 4 4 4 * 16777216 0 0 0 This patch set is huge, and contains a bunch of cleanups and fixes that came out of the two main thrusts: hugeadm and pagesize. The first 7 patches are basically infrastructure updates, some of these are Adams original patches rebased onto the latest master): utils: Make pool counter manipulation code part of the library API shm: Shared memory always uses the meminfo page size Do not allow zero as an explicit page size hugeutils: size_to_smaller_unit should allow 2GB pages hugeutils: pull out common filenames build: allow utilities to consist of more than one file debug: allow utilities to share the common debug reporter The next 6 patches represent hugeadm: hugeadm: initial basic framework hugeadm: expose the pool configuration hugeadm: sort the pool configuration output by size and mark the default hugeutils: export the pool counter update interface hugeadm: allow pools to be resized hugeadm: expose the available and possible page sizes The final 4 represent the pagesize utility and its supporting interfaces (again some of these are Adams original patches rebased): lib: Add gethugepagesizes() API call lib: add a getpagesizes call returning all page sizes hugeutils: gethugepagesizes -- ensure we ignore unrepresentable page sizes pagesize: add utility to list page sizes This is getting close to 'finished' so now is the time to scream about fundamentals. For instance we have just change the name to hugeadm. Comments? -apw Adam Litke (4): utils: Make pool counter manipulation code part of the library API shm: Shared memory always uses the meminfo page size Do not allow zero as an explicit page size lib: Add gethugepagesizes() API call Andy Whitcroft (13): hugeutils: size_to_smaller_unit should allow 2GB pages hugeutils: pull out common filenames build: allow utilities to consist of more than one file debug: allow utilities to share the common debug reporter hugeadm: initial basic framework hugeadm: expose the pool configuration hugeadm: sort the pool configuration output by size and mark the default hugeutils: export the pool counter update interface hugeadm: allow pools to be resized hugeadm: expose the available and possible page sizes lib: add a getpagesizes call returning all page sizes hugeutils: gethugepagesizes -- ensure we ignore unrepresentable page sizes pagesize: add utility to list page sizes Makefile | 28 +++- hugeadm.c | 313 ++++++++++++++++++++++++++++ hugetlbfs.h | 18 ++ hugeutils.c | 382 ++++++++++++++++++++++++++++++++--- libhugetlbfs_internal.h | 16 ++- pagesize.c | 143 +++++++++++++ shm.c | 7 +- tests/Makefile | 7 +- tests/alloc-instantiate-race.c | 5 +- tests/chunk-overcommit.c | 3 +- tests/counters.c | 38 ++-- tests/get_huge_pages.c | 14 +- tests/gethugepagesizes.c | 278 +++++++++++++++++++++++++ tests/heap-overflow.c | 2 +- tests/hugetests.h | 20 +-- tests/libtestutils.c | 137 +++++++++++++ tests/misaligned_offset.c | 20 +- tests/quota.c | 6 +- tests/run_tests.sh | 1 + tests/shmoverride_unlinked.c | 82 +++++++- tests/testutils.c | 252 +----------------------- tests/truncate_reserve_wraparound.c | 21 +- tests/truncate_sigbus_versus_oom.c | 3 +- 23 files changed, 1415 insertions(+), 381 deletions(-) create mode 100644 hugeadm.c create mode 100644 pagesize.c create mode 100644 tests/gethugepagesizes.c create mode 100644 tests/libtestutils.c ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Libhugetlbfs-devel mailing list Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel