mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::fs::map: Add hugepage related to interface opts.
This commit is contained in:
parent
fdd052da87
commit
59106f9456
2 changed files with 28 additions and 0 deletions
|
@ -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)
|
||||
|
|
26
ircd/fs.cc
26
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue