We deploy and use (home grown applications internally) all of which actually use hugepages and the mmap() syscall. But I would prefer to restrict some of the applications from actually using huge page support. Can this be achieved by any changes in the code or any system wide config options which could be implemented?
How to restrict users or applications from using hugepage support?
4.6k views Asked by Greg Petr At
1
I would recommend setting and using the kernel tunable option
vm.hugetlb_shm_group=<GID>in/etc/sysctl.confor manually throughhugeadmcommand. The example below means only members of group mygroup(2341) can allocate "huge" Shared memory segmentNote: Only (the users part of) the group listed in
vm.hugetlb_shm_groupkernel tunable, sysctl will be able to useshmget()andshmat()calls to access the HugePages. However any user calling mmap() can access HugePages. Your code may require some some changes accordingly, if only usingmmap().Only one group can be defined as the
vm.hugetlb_shm_group. After updating the values of kernel parameters in the/etc/sysctl.conffile, either restart the computer, or run the commandsysctl -pto make the changes in the/etc/sysctl.conffile available in the active kernel memory.Refer:
hugeadmcommand.