[This version includes a lot of feedback from Mel and Adam. If you think I've ignored your feedback please assume I missed it somewhere as there really was a lot of good feedback in there.]
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 hpoolcfg. 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 hpoolcfg, this differs in that the sizes listed here are those with a working mountpoint as well as pages: [EMAIL PROTECTED] ./obj/hpoolcfg --page-sizes 2097152 65536 [EMAIL PROTECTED] ./obj/hpoolcfg --page-sizes-all 2097152 65536 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 2097152 4 4 4 65536 15 15 30 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/hpoolcfg --pool-minimum-adjust 64kb:5 \ --pool-maximum-adjust 64kb:10 [EMAIL PROTECTED] ./obj/hpoolcfg --pool-list Size Minimum Current Maximum 2097152 4 4 4 65536 5 5 10 16777216 0 0 0 They may be adjusted with relative deltas: [EMAIL PROTECTED] ./obj/hpoolcfg --pool-maximum-adjust 64kb:+5 [EMAIL PROTECTED] ./obj/hpoolcfg --pool-list Size Minimum Current Maximum 2097152 4 4 4 65536 5 5 15 16777216 0 0 0 This code is not intended for merging as it is, but more as a work in progress allowing discussion of the overall strategy and direct discussion of the interfaces and the semantics they provide. Any comments on the direction greatly appreciated. This patch set is huge, and contains a bunch of cleanups and fixes that came out of the two main thrusts: hpoolcfg 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 5 patches represent hpoolcfg: hpoolcfg: initial basic framework hpoolcfg: expose the pool configuration hugeutils: export the pool counter update interface hpoolcfg: allow pools to be resized hpoolcfg: 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 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 (12): 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 hpoolcfg: initial basic framework hpoolcfg: expose the pool configuration hugeutils: export the pool counter update interface hpoolcfg: allow pools to be resized hpoolcfg: 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 +++- hpoolcfg.c | 249 +++++++++++++++++++++++ hugetlbfs.h | 18 ++ hugeutils.c | 372 ++++++++++++++++++++++++++++++++--- libhugetlbfs_internal.h | 14 ++- 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 | 279 ++++++++++++++++++++++++++ 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, 1340 insertions(+), 381 deletions(-) create mode 100644 hpoolcfg.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