usertools: add option for hugetlbfs directory

dpdk-hugepages.py had /dev/hugepages hardcoded as the mount point.
It may be desirable to setup hugepage directory at another path,
for example, when using hugepages of multiple sizes in different
directories or when granting different permissions to mount points.
Add --directory/-d option to the script.

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
Dmitry Kozlyuk 2022-06-24 16:19:52 +03:00 committed by Thomas Monjalon
parent 5cfaa3c3b0
commit 31af02ef6f

View File

@ -228,6 +228,12 @@ def main():
'-u',
action='store_true',
help='unmount the system huge page directory')
parser.add_argument(
'--directory',
'-d',
metavar='DIR',
default=HUGE_MOUNT,
help='mount point')
parser.add_argument(
'--node', '-n', help='select numa node to reserve pages on')
parser.add_argument(
@ -262,7 +268,7 @@ def main():
if args.clear:
clear_pages()
if args.unmount:
umount_huge(HUGE_MOUNT)
umount_huge(args.directory)
if args.reserve:
reserve_kb = get_memsize(args.reserve)
@ -273,7 +279,7 @@ def main():
reserve_pages(
int(reserve_kb / pagesize_kb), pagesize_kb, node=args.node)
if args.mount:
mount_huge(pagesize_kb, HUGE_MOUNT)
mount_huge(pagesize_kb, args.directory)
if args.show:
show_pages()
print()