Skip to content


March 3, 2011

Hugepages are of size 2MB.They are enabled by setting PS in Page Directory Entry. When hugepages are enabled, one of the page walk is reduced since we get 2MB page one level earlier. This improves the performance of the system upto 30-40 and some times even higher if they are used properly. Hugepages can even degrade the performance of the system if thrashing is the case as if IO time required for DMA to get 2MB page is more quite more than 4KB page.
Hugepages can be enabled by giving boot option or other option is

# echo 20 > /proc/sys/vm/nr_hugepages
# cat /proc/meminfo | grep Huge

Hugepages are not handled with 4KB singleton pages. For maintaining hugepages pool, kernel creates its own buddy-allocator. Following data-structure is used for creating buddy:

struct hstate {
int next_nid_to_alloc;
int next_nid_to_free;
unsigned int order;
unsigned long mask;
unsigned long max_huge_pages;
unsigned long nr_huge_pages;
unsigned long free_huge_pages;
unsigned long resv_huge_pages;
unsigned long surplus_huge_pages;
unsigned long nr_overcommit_huge_pages;
struct list_head hugepage_freelists[MAX_NUMNODES];
unsigned int nr_huge_pages_node[MAX_NUMNODES];
unsigned int free_huge_pages_node[MAX_NUMNODES];
unsigned int surplus_huge_pages_node[MAX_NUMNODES];
char name[HSTATE_NAME_LEN];


From → Kernel

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: