diff mbox series

[v2,1/4] usertools: add option to select hugetlbfs directory

Message ID 20220617112508.3823291-2-dkozlyuk@nvidia.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series Improve documentation for running as non-root | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Dmitry Kozlyuk June 17, 2022, 11:25 a.m. UTC
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>
---
 usertools/dpdk-hugepages.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Bruce Richardson June 17, 2022, 3:50 p.m. UTC | #1
On Fri, Jun 17, 2022 at 02:25:05PM +0300, Dmitry Kozlyuk wrote:
> 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>
diff mbox series

Patch

diff --git a/usertools/dpdk-hugepages.py b/usertools/dpdk-hugepages.py
index 4fdb199744..8bab086a2f 100755
--- a/usertools/dpdk-hugepages.py
+++ b/usertools/dpdk-hugepages.py
@@ -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()