From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id CC693A05D3 for ; Thu, 23 May 2019 16:29:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F073F1B947; Thu, 23 May 2019 16:29:57 +0200 (CEST) Received: from mail-ua1-f65.google.com (mail-ua1-f65.google.com [209.85.222.65]) by dpdk.org (Postfix) with ESMTP id B2FA21B946 for ; Thu, 23 May 2019 16:29:56 +0200 (CEST) Received: by mail-ua1-f65.google.com with SMTP id u4so2232494uau.10 for ; Thu, 23 May 2019 07:29:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+8eJuf8FA7sQtSo2zFBkQcVg2Z55t/yEgAgDEaSMV7Q=; b=DbVPA2BC164r+CCmONfSSSX/fKeC3ADiYE30id2ZW7BNP2+Z4VVHlGPLQViSWusMqE E/rsGx7a2/rG69iCUwkM+po7e1o6IhisfsFP+8kW4l0bEtGGyWPjGXJPdIjJAts0cJqR X6tU3ccxa/OhGBhWM+n7kXQmX7NmJ5NfmQu+vhD171rUsUlmErAICWu0R9p3Wg5pWU4T mWax2FLMqIxkChPg/BA6SWPtfUUviDZn811k4TqGJPffkRxBo+PdtPhtPtONuSw6ZSHZ kdn+OQAj83/tqkhBjjN3WIHhV3R7CR1GCRPOOdZdaf1w8hc+V2BKo5prCtIUmxc8CrnA 2q5g== X-Gm-Message-State: APjAAAUG4VWZK1qzwdHI7O3h0yFIgT5hLFdtV5rsv8PuyCIYPNqo2u4w Yz+x/baZDQSEupWiz5sGqAhxrxHp8rEIq45hRRqn9g== X-Google-Smtp-Source: APXvYqzvottPS04+a+rtrhGASV+V1ueMb6+RyHOX5xROEGCpCaDEcQQhkbFvaLEQ2ejbPNJQvuD1yAiHvAluI1oILh8= X-Received: by 2002:ab0:5930:: with SMTP id n45mr35000896uad.87.1558621796024; Thu, 23 May 2019 07:29:56 -0700 (PDT) MIME-Version: 1.0 References: <20190523095231.1091-1-nicolas.dichtel@6wind.com> In-Reply-To: <20190523095231.1091-1-nicolas.dichtel@6wind.com> From: David Marchand Date: Thu, 23 May 2019 16:29:44 +0200 Message-ID: To: Nicolas Dichtel Cc: dev , Anatoly Burakov , dpdk stable , Olivier Matz , Didier Pallard Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v2] mem: ease init in a docker container X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, May 23, 2019 at 11:53 AM Nicolas Dichtel wrote: > 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 > Reviewed-by: Olivier Matz > Reviewed-by: Didier Pallard > Acked-by: Anatoly Burakov > --- > > 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 > > Reviewed-by: David Marchand -- David Marchand