diff --git a/include/ircd/fs/map.h b/include/ircd/fs/map.h index bccde87cd..f522f4ee5 100644 --- a/include/ircd/fs/map.h +++ b/include/ircd/fs/map.h @@ -49,6 +49,8 @@ struct ircd::fs::map::opts bool reserve {false}; bool populate {false}; bool locked {false}; + bool huge2mb {false}; + bool huge1gb {false}; opts(const fd::opts &opts = {std::ios::in}) :fd::opts(opts) diff --git a/ircd/fs.cc b/ircd/fs.cc index f62ed0582..5fe291d6c 100644 --- a/ircd/fs.cc +++ b/ircd/fs.cc @@ -2186,6 +2186,32 @@ ircd::fs::flags(const map::opts &opts) ret |= MAP_LOCKED; #endif + #if defined(MAP_HUGE_TLB) && defined(MAP_HUGE_2MB) + if(opts.huge2mb) + ret |= MAP_HUGETLB | MAP_HUGE_2MB; + #elif defined(MAP_HUGE_SHIFT) + if(opts.huge2mb) + ret |= (21 << MAP_HUGE_SHIFT); + #elif defined(MAP_HUGETLB) + if(opts.huge2mb) + ret |= MAP_HUGE_TLB + #else + #warning "MAP_HUGETLB (2MB) not supported" + #endif + + #if defined(MAP_HUGE_TLB) && defined(MAP_HUGE_1GB) + if(opts.huge1gb) + ret |= MAP_HUGE_1GB; + #elif defined(MAP_HUGE_SHIFT) + if(opts.huge1gb) + ret |= (30 << MAP_HUGE_SHIFT); + #elif defined(MAP_HUGE_TLB) + if(opts.huge1gb) + ret |= MAP_HUGE_TLB + #else + #warning "MAP_HUGETLB (1GB) not supported" + #endif + return ret; }