Per mount(8), the previous owner and mode of the mount point
become invisible as long as this filesystem remains mounted.
Because dpdk-hugepages.py must be run as root,
the new owner would be root.
This is undesirable if the hugepage directory is being set up
by the administrator for an unprivileged user.
HugeTLB filesystem has options to set the mount point owner.
Add --user/-U and --group/-G options to apply this when mounting.
The benefit of performing this in dpdk-hugepages.py
is that the user does not need to care about this detail
of mount command operation.
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
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>
In case the number of requested hugepages cannot be set,
a more detailed error message is printed.
The new message does not mention "reserve" because setting
can be reserving or clearing.
The filename and numbers requested/set are printed to ease debugging.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
The default page size can be None, and the page size from user request
can be 0 kB if lower than 1024. In these cases, a division will fail.
In order to avoid a Python exception, the page size is checked
and an error message "Invalid page size" is printed.
A similar error message is printed in set_hugepages()
if the size is not supported, except at this stage the message can be
completed with "Valid page sizes".
Unfortunately the first check is too early to print such information.
A third error message can be printed in a different place (get_memsize)
in case of a format issue, e.g. a negative size.
The function get_memsize() is also used for total requested size,
so the error message "not a valid page size" was potentially wrong.
This message is replaced with the more general "is not a valid size".
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
If user requests a hugepage size which is not supported by the system,
currently user gets an error message saying that the requested size
is not a valid system huge page size. In addition to this if we display
the valid hugepage sizes it will be convenient for the user to request
the right size next time.
Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Sometimes the system is unable to reserve the requested hugepages because
enough space is not available in the RAM. In that case, currently the
script displays no error message hence the user can be under the delusion
that the hugepages requested are all successfully reserved. This patch
displays an error message if the pages reserved are different from the
requested pages.
Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
The IBM PowerNV systems include NUMA nodes that don't have associated
CPUs or hugepage memory. Here is an example on an IBM AC922 system:
$ lscpu
...
NUMA node0 CPU(s): 0-63
NUMA node8 CPU(s): 64-127
NUMA node252 CPU(s):
...
$ numastat -m
...
Node 0 Node 8 Node 252
--------------- --------------- ---------------
MemTotal 126763.19 130785.06 0.00
MemFree 119513.38 125294.44 0.00
MemUsed 7249.81 5490.62 0.00
...
HugePages_Total 4.00 1734.00 0.00
HugePages_Free 0.00 4.00 0.00
HugePages_Surp 4.00 1730.00 0.00
...
Modify dpdk-hugepages.py to test for the ../hugepages directory before
attempting to parse the hugepage entries.
Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
This is an improved version of the setup of huge pages
bases on earlier DPDK setup.
Differences are:
* autodetects NUMA vs non NUMA
* allows setting different page sizes
recent kernels support multiple sizes.
* accepts a parameter in bytes (not pages).
* can display current hugepage settings.
Most users will just use --setup argument but if necessary
the steps of clearing old settings and mounting/umounting
can be done individually.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>