There has been some disagreement on what the exact purpose of get_huge_pages()
is. It was felt that the interface name implied that it dealt strictly with
hugepages. This was reinforced by the fact in 2.0 that the length parameter
had to be hugepage-aligned and that in 2.1-preX allocations were allowed
to fall back to base pages. This led to resistance when the scope of the
function was expanded further to include cache coloring.

Rather than fighting endlessly, this patch series starts by enforcing that
get_huge_pages() is a low-level interface dealing exclusively with huge
pages.  It no longer allows fallback and instead GHP_ flags in the future
will determine what size of hugepages should be used - e.g. GHP_LARGEST.

The patch then adds a new API called get_hugepage_region() that is intended
to be vaguely malloc-like for the allocation of regions of memory that are
backed by hugepages where possible. It is not responsible for doing packing
like a true malloc-like interface would but it allows an unaligned length
and fallback to base pages. The last patch adds support for coloring buffers
allocated by get_hugepage_region().

See http://www.csn.ul.ie/~mel/compare-gethugepage-gethugeregion.ps

It compares the two APIs when used once to allocate three buffers and called
once for each of the three buffers. Note that calling get_huge_page()
three times blows for performance as the three arrays use the same cache
lines at the same offsets. get_hugepage_region() does not suffer the same
problem as much as an effort is made to color the buffer.

Changelog since V1
  o Correct typo in man pages (Jon)
  o Cache color shuffle (Adam)

 Makefile                    |    5 +-
 alloc.c                     |  125 ++++++++++++++++++++++++++++++++++++-----
 hugetlbfs.h                 |   37 ++++++++++---
 man/get_huge_pages.3        |   22 ++++---
 man/get_hugepage_region.3   |   86 ++++++++++++++++++++++++++++
 tests/Makefile              |    4 +-
 tests/get_huge_pages.c      |   53 ------------------
 tests/get_hugepage_region.c |  129 +++++++++++++++++++++++++++++++++++++++++++
 tests/run_tests.sh          |    3 +
 version.lds                 |    2 +
 10 files changed, 378 insertions(+), 88 deletions(-)
 create mode 100644 man/get_hugepage_region.3
 create mode 100644 tests/get_hugepage_region.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

Reply via email to