Hi, I'm new to this list I'm using freshly-downloaded "stable" release, I'm just getting started so I may say some uninformed things. I'm on Xubuntu 14.04, x86-64, with 64GB RAM, of which I have reserved 24 GB for huge pages, intending to use it as a cache for a search in a game. Pages are accorningly 4KiB and 2MiB.
I'm a retired programmer with a special fondness for good documentation, willing to help write it. I have a little program I used to verify that I'm understanding things properly, attached. Its behavior deviates from the man pages. Specifically, a call to get_hugepage_region() that intentionally requests a region that is too large is being aborted in the library with a "warning" message. My beefs: - I don't expect warnings to abort - I really really don't like aborts from a library. It's the wrong place to make that decision. - the man page says it will return with NULL and something in errno. The message says it's from get_huge_pages, which I presume is an inner call, but that's also documented to return NULL. -- Kevin O'Gorman #define QUESTION ((bb) || (!bb)) /* Shakespeare */ Please consider the environment before printing this email.
/** * @file * <pre>Test of how to use a huge page mapping or a malloc (for time tests). * You can watch the progress by using the command * grep Huge /proc/meminfo</pre> * Last Modified: Fri Dec 12 16:10:57 PST 2014 * @author Kevin O'Gorman */ #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <hugetlbfs.h> #define BUFL 1000 #define SIZE (32LLU*1024*1024*1024) #define FLAGS (GHR_STRICT | GHR_COLOR) int main(int argc, char *argv[]) { char *region; char buf[BUFL]; size_t stride = sysconf(_SC_PAGESIZE); int i; if (argc > 1) { region = (char *)malloc((size_t)SIZE); } else { region = (char *)get_hugepage_region((size_t)SIZE, GHR_DEFAULT); } if (!region) { if (argc>1) { /* malloc just about never fails on 64-bit processes. Doesn't mean you * should do this. */ sprintf(buf, "Malloc of %lld bytes", (long long)SIZE); } else { /* The library actually doesn't even return in this case. */ sprintf(buf, "get_hugepage_region of %lld bytes", (long long)SIZE); } perror(buf); exit(EXIT_FAILURE); } for (i = 0; i < SIZE; i+=stride) { region[i] = 0; } return EXIT_SUCCESS; }
Makefile
Description: Binary data
------------------------------------------------------------------------------ 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 Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel