From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CF4DEA0524; Tue, 13 Apr 2021 10:33:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D0DE160C85; Tue, 13 Apr 2021 10:33:47 +0200 (CEST) Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) by mails.dpdk.org (Postfix) with ESMTP id 43E9F160C84 for ; Tue, 13 Apr 2021 10:33:45 +0200 (CEST) Received: by mail-ej1-f53.google.com with SMTP id u17so24607523ejk.2 for ; Tue, 13 Apr 2021 01:33:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MQnB8TpZDtJGA2len3YMOLZ1yknFbF0HK/T1eicGNuU=; b=ZrWuxyi4BUi4eOUc/bVHp9DxLgr1lV0lwMTgJmH2o9Lc9alKVVJTHU6+5h6ktxgywR bF3XVL9rrPrUHsKYuhKHsrBS9VoTCBYg5Kl2poC6gk071KXsIy3Ot/Vvq8o6OzobrclF 0dKXDDJ3+BPbJx52Pq4M5ThKVTvbni8NKOS86S/SgviY/q5caI/xJBKDjwndEu4+AkLZ vEzPhxm7A1zC5IJ+ihKNwFJPMvJim2B2Hc9pml+AXjjgIVjyBs8fufLkee4ddlQcUthU j6oaA4phLEGJgET1in7rOnM+Oo2+LeeJcja/QWWEFEFrNvjeQowQ1ii6hPkdGPrttjlW VQBw== 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=MQnB8TpZDtJGA2len3YMOLZ1yknFbF0HK/T1eicGNuU=; b=Ai2gpglA6h8/9Tfk5okyDYfrWbALJ86w+b9bCjFy218HsKvg0Gm7nvVVHfzPVwyitD LQFLA+AmYTp96AONTZoHplbT2xW3KlAqvSQSBvTO8BPCQiKR0YGiBJaz0cQgH73DQ2QN L5h3dlfzMCAvkzd8cjixiAzUefJzOZN+vO5F2YIEcGMmduXUpkI1oXbguX3uGaAkdPo3 J7uAqblZmTBp/yP2dlYLhHQj4XQ4Aub9Z1MNYUgkw67mZ9tEDkGp3Xl9CbwkhQGFYUtD wqTXyWEAiVmNonz3bGnBOqYSXZguvjjFTcjAPrRwWx2wLD3nmpSQCu99rdQOO59hrvBi 9u8Q== X-Gm-Message-State: AOAM530+CeT6Hp49qMzNsBEJFPj8Lci1i7QcysI3dM4ShRzbsi/P1pHX SkuPajlk1oto6LyG775McJ88BT60/cSOFDLsF/UJJKDTJa8= X-Google-Smtp-Source: ABdhPJxeKeVMB8Lrk1HDAuhoCIaySQHkYV7eotvXnxfFNP7m6IVFtWxZVkidIi8BHLVm4FK87SFOnPfjuSCAR3fnAMU= X-Received: by 2002:a17:906:af5a:: with SMTP id ly26mr5507543ejb.372.1618302825186; Tue, 13 Apr 2021 01:33:45 -0700 (PDT) MIME-Version: 1.0 References: <20210325082125.37488-1-xiangxia.m.yue@gmail.com> In-Reply-To: <20210325082125.37488-1-xiangxia.m.yue@gmail.com> From: Tonghao Zhang Date: Tue, 13 Apr 2021 16:32:44 +0800 Message-ID: To: "Burakov, Anatoly" Cc: dpdk-dev Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH] eal/linux: add operation LOCK_NB to flock() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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, Mar 25, 2021 at 4:25 PM wrote: > > From: Tonghao Zhang ping > The hugepage of different size, 2MB, 1GB may be mounted on > the same directory (e.g /dev/hugepages). Then dpdk > primary process will be blocked. To address this issue, > add the LOCK_NB flags to flock(). > > $ cat /proc/mounts > ... > none /dev/hugepages hugetlbfs rw,seclabel,relatime,pagesize=1024M 0 0 > none /dev/hugepages hugetlbfs rw,seclabel,relatime,pagesize=2M 0 0 > > Add more details for err logs. > > Signed-off-by: Tonghao Zhang > --- > lib/librte_eal/linux/eal_hugepage_info.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/lib/librte_eal/linux/eal_hugepage_info.c b/lib/librte_eal/linux/eal_hugepage_info.c > index d97792cadeb6..1ff76e539053 100644 > --- a/lib/librte_eal/linux/eal_hugepage_info.c > +++ b/lib/librte_eal/linux/eal_hugepage_info.c > @@ -451,9 +451,12 @@ hugepage_info_init(void) > hpi->lock_descriptor = open(hpi->hugedir, O_RDONLY); > > /* if blocking lock failed */ > - if (flock(hpi->lock_descriptor, LOCK_EX) == -1) { > + if (flock(hpi->lock_descriptor, LOCK_EX | LOCK_NB) == -1) { > RTE_LOG(CRIT, EAL, > - "Failed to lock hugepage directory!\n"); > + "Failed to lock hugepage directory! " > + "The hugepage dir (%s) was locked by " > + "other processes or self twice.\n", > + hpi->hugedir); > break; > } > /* clear out the hugepages dir from unused pages */ > -- > 2.27.0 > -- Best regards, Tonghao