From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: dev@dpdk.org
Cc: Anatoly Burakov <anatoly.burakov@intel.com>,
Nicolas Dichtel <nicolas.dichtel@6wind.com>,
stable@dpdk.org, Olivier Matz <olivier.matz@6wind.com>,
Didier Pallard <didier.pallard@6wind.com>
Subject: [dpdk-dev] [PATCH v2] mem: ease init in a docker container
Date: Thu, 23 May 2019 11:52:31 +0200 [thread overview]
Message-ID: <20190523095231.1091-1-nicolas.dichtel@6wind.com> (raw)
In-Reply-To: <CAJFAV8xFNDWZ_q=ecu8u5KqApeW04rZuOi5ZG7yNKYGs7sKaBQ@mail.gmail.com>
move_pages() is only used to get the numa node id, but this function
is not allowed by default in docker (it needs CAP_SYS_NICE and an update of
the seccomp profile).
get_mempolicy() also requires CAP_SYS_NICE but doesn't need any change in
the default seccomp profile.
Note that the returned value of move_pages() was not checked, thus some
errors could be hidden (if the requested id was 0).
Cc: stable@dpdk.org
Fixes: 582bed1e1d1d ("mem: support mapping hugepages at runtime")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Didier Pallard <didier.pallard@6wind.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
v2: add fixes tag + cc stable
fix title prefix
lib/librte_eal/linux/eal/eal_memalloc.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c b/lib/librte_eal/linux/eal/eal_memalloc.c
index 1e9ebb86dd1b..438faa0ab168 100644
--- a/lib/librte_eal/linux/eal/eal_memalloc.c
+++ b/lib/librte_eal/linux/eal/eal_memalloc.c
@@ -600,9 +600,13 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
}
#ifdef RTE_EAL_NUMA_AWARE_HUGEPAGES
- move_pages(getpid(), 1, &addr, NULL, &cur_socket_id, 0);
-
- if (cur_socket_id != socket_id) {
+ ret = get_mempolicy(&cur_socket_id, NULL, 0, addr,
+ MPOL_F_NODE | MPOL_F_ADDR);
+ if (ret < 0) {
+ RTE_LOG(DEBUG, EAL, "%s(): get_mempolicy: %s\n",
+ __func__, strerror(errno));
+ goto mapped;
+ } else if (cur_socket_id != socket_id) {
RTE_LOG(DEBUG, EAL,
"%s(): allocation happened on wrong socket (wanted %d, got %d)\n",
__func__, socket_id, cur_socket_id);
--
2.21.0
next prev parent reply other threads:[~2019-05-23 9:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-22 15:41 [dpdk-dev] [PATCH] librte_eal: ease init in a docker container Nicolas Dichtel
2019-05-22 15:57 ` Burakov, Anatoly
2019-05-22 16:08 ` Nicolas Dichtel
2019-05-23 8:48 ` Burakov, Anatoly
2019-05-23 8:56 ` Burakov, Anatoly
2019-05-23 9:00 ` David Marchand
2019-05-23 9:52 ` Nicolas Dichtel [this message]
2019-05-23 14:29 ` [dpdk-dev] [dpdk-stable] [PATCH v2] mem: " David Marchand
2019-06-04 11:05 ` Thomas Monjalon
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=20190523095231.1091-1-nicolas.dichtel@6wind.com \
--to=nicolas.dichtel@6wind.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=didier.pallard@6wind.com \
--cc=olivier.matz@6wind.com \
--cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.