Mr Pang
Mr Pang

Reputation: 1181

Can I limit the hugepages size of dpdk?

I have two programs, one is based on dpdk. And both use hugepages. But dpdk uses up all hugepages by default. I can't find any document about how to set the hugepages size that dpdk can use. Is there any handy way to do this? If not, I have to research dpdk source and modify it.

Upvotes: 1

Views: 828

Answers (3)

Vipin Varghese
Vipin Varghese

Reputation: 4798

A couple of caveats, till DPDK 18.11 option -m and --socket-mem does as what @andriy states. But with the release of DPDK 19.11, there has been huge revamp in the internal logic.

For higher version than 18.11 mode use --legacy-mem to emulate the older memory model. But if legacy-mode is not the choice, use --socket-limit.

Assuming the platform is x86 (as 2MB and 1GB), as far as I recollect 2MB can be dynamically changed while 1GB can not be dynamically allocated. Hence any options passed in kernel cmd line will result in equal allocation from all NUMA.

Upvotes: 1

vjosyula
vjosyula

Reputation: 1

To add, one can also use this addition to above whatever @andriy mentioned to implicitly set hard limit /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages for 2MB hugepage size

Similarly for 1G on too we can do it, but that depends support.

Upvotes: 0

Andriy Berestovskyy
Andriy Berestovskyy

Reputation: 8544

Sure, there are few command line options. The easiest is -m <megabytes>, but it’s internal logic might be completely wrong if you have a few NUMA nodes.

I recommend to use —socket-mem <mbytes,mbytes,...> instead, which allows to allocate a specific amount of megabytes per NUMA node.

For more details please see: https://doc.dpdk.org/guides/linux_gsg/linux_eal_parameters.html

Upvotes: 1

Related Questions