From: "xu,huilong" <huilongx.xu@intel.com>
To: dts@dpdk.org
Cc: "xu,huilong" <huilongx.xu@intel.com>
Subject: [dts] [PATCH V1] update hugepage config
Date: Wed, 31 Aug 2016 13:23:54 +0800 [thread overview]
Message-ID: <1472621034-10935-1-git-send-email-huilongx.xu@intel.com> (raw)
dts only config 2M hugepage for dut. if when user want to used
another size hugepage. user must set hugepage number in kernel cmdline.
but some times we should chang hugepage number in different target or case.
Signed-off-by: xu,huilong <huilongx.xu@intel.com>
---
framework/crb.py | 8 +++++++-
framework/dut.py | 43 +++++++++++++++++++++----------------------
2 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/framework/crb.py b/framework/crb.py
index 066bb3f..c873ffc 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -163,7 +163,13 @@ class Crb(object):
Set numbers of huge pages
"""
page_size = self.send_expect("awk '/Hugepagesize/ {print $2}' /proc/meminfo", "# ")
-
+ # we set huge page number default used 2M size,
+ # so should count huge number again with systerm huge page size
+ # 100 is a estimate value,
+ # it means, if the huge_page num bigger 100, we think the user want used 2M hugepage
+ if (huge_pages > 100):
+ huge_pages = (((huge_pages * 1024 * 2 ) / int(page_size)) or 1)
+
if numa == -1:
self.send_expect('echo %d > /sys/kernel/mm/hugepages/hugepages-%skB/nr_hugepages' % (huge_pages, page_size), '# ', 5)
else:
diff --git a/framework/dut.py b/framework/dut.py
index 2f4e53a..8525873 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -292,28 +292,27 @@ class Dut(Crb):
hugepages_size = self.send_expect("awk '/Hugepagesize/ {print $2}' /proc/meminfo", "# ")
total_huge_pages = self.get_total_huge_pages()
force_socket = False
-
- if int(hugepages_size) < (1024 * 1024):
- if self.architecture == "x86_64":
- arch_huge_pages = hugepages if hugepages > 0 else 4096
- elif self.architecture == "i686":
- arch_huge_pages = hugepages if hugepages > 0 else 512
- force_socket = True
- # set huge pagesize for x86_x32 abi target
- elif self.architecture == "x86_x32":
- arch_huge_pages = hugepages if hugepages > 0 else 256
- force_socket = True
- elif self.architecture == "ppc_64":
- arch_huge_pages = hugepages if hugepages > 0 else 512
-
- if total_huge_pages != arch_huge_pages:
- # before all hugepage average distribution by all socket,
- # but sometimes create mbuf pool on socket 0 failed when setup testpmd,
- # so set all huge page on socket 0
- if force_socket:
- self.set_huge_pages(arch_huge_pages, 0)
- else:
- self.set_huge_pages(arch_huge_pages)
+ # support set 1G hugepage by dts
+ if self.architecture == "x86_64":
+ arch_huge_pages = hugepages if hugepages > 0 else 4096
+ elif self.architecture == "i686":
+ arch_huge_pages = hugepages if hugepages > 0 else 512
+ force_socket = True
+ # set huge pagesize for x86_x32 abi target
+ elif self.architecture == "x86_x32":
+ arch_huge_pages = hugepages if hugepages > 0 else 256
+ force_socket = True
+ elif self.architecture == "ppc_64":
+ arch_huge_pages = hugepages if hugepages > 0 else 512
+
+ if total_huge_pages != arch_huge_pages:
+ # before all hugepage average distribution by all socket,
+ # but sometimes create mbuf pool on socket 0 failed when setup testpmd,
+ # so set all huge page on socket 0
+ if force_socket:
+ self.set_huge_pages(arch_huge_pages, 0)
+ else:
+ self.set_huge_pages(arch_huge_pages)
self.mount_huge_pages()
self.hugepage_path = self.strip_hugepage_path()
--
1.9.3
reply other threads:[~2016-08-31 5:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1472621034-10935-1-git-send-email-huilongx.xu@intel.com \
--to=huilongx.xu@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).