Skip to content

ON-16341: force 2MB huge page allocation to run on 1GB default systems #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/lib/zf/pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <errno.h>
#include <sys/mman.h>
#include <linux/mman.h>

#ifndef MAP_HUGETLB
#define MAP_HUGETLB 0x40000u
Expand Down Expand Up @@ -84,7 +85,7 @@ int zf_pool_alloc(struct zf_pool_res* pi, struct zf_pool* pool,
* to continue to use them as DMA buffers. */
pool->pkt_bufs =
(char*) zf_hal_mmap(NULL, alloc_size, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_SHARED | MAP_HUGETLB, -1, 0);
MAP_ANONYMOUS | MAP_SHARED | MAP_HUGETLB | MAP_HUGE_2MB, -1, 0);
pi->pkt_bufs_mmap_len = alloc_size;

/* Huge pages only */
Expand Down
3 changes: 2 additions & 1 deletion src/lib/zf/stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/mman.h>

#include <ci/efhw/mc_driver_pcol.h>

Expand All @@ -36,7 +37,7 @@

void* __alloc_huge(size_t size)
{
unsigned mmap_flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_HUGETLB;
unsigned mmap_flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_HUGETLB | MAP_HUGE_2MB;
auto ptr = (char*) mmap(NULL, size, PROT_READ | PROT_WRITE, mmap_flags, -1, 0);
if( ptr == MAP_FAILED )
return NULL;
Expand Down