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 BBDC7A0C49; Wed, 7 Jul 2021 22:06:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 340F1413DB; Wed, 7 Jul 2021 22:06:09 +0200 (CEST) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) by mails.dpdk.org (Postfix) with ESMTP id 80E49413B6 for ; Wed, 7 Jul 2021 22:06:07 +0200 (CEST) Received: by mail-lf1-f43.google.com with SMTP id f30so7382665lfj.1 for ; Wed, 07 Jul 2021 13:06:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e+fxMYq8ipPgcU6UuL/vZDcKopK1EZP4PZAI29c2ITA=; b=lLiyWI+vOp3xawe19aeuZu3JHGTjUssv3PIVn6tsZuLQtth7fFOCK4XB1c8HMe/Ixk ujYum+HQYUn/RPVYGfgswHLbMsuoZ4pCPqEsj8XXVe4/3/0ms1sT4fRKV7FyBBt+L0Sr fWHWaxlz+U8+yaInFXEG70zpoIR9+2nHaaqKT12Dl0nIafn0oN3rUSdPEDtBacbFa7EA vrS81AVccUAs27dm7Y7Jr8T1piKnuMjOI4PSSY8brUBDz8yIWfFd3N4EbCO/WEcglqqA YE95M3x73Jz+2yp5POnx6t9FG4ew6ogk7UeY+9h23pp0sNUQPWUpavQUsMYiZpH1kzvg aU0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e+fxMYq8ipPgcU6UuL/vZDcKopK1EZP4PZAI29c2ITA=; b=R4JDWiCl4WQTH5GB5I8Y3TP5ltw4KhRZb2mbfoytGdsg3ZgVs6Pq1OqoK4J441XxNH aJbIGJsGEmY1F4WjOihUqTeV5LMNcoveuFu2uWvOMyIKSK/UtgCDXAyQL1jlw1zIxCfP vCrjxtT+02+gdvddzjxD/M6uHMK4OxZX8x46Tk/noXdoZukSFG67BXF6uyvtjFsXSRZv Kdl+ejjP2mSRwedzD8W5nxy/iuN5mBSETo2sNKqiY8CBFhFBJno/p5pNKVUmJqjpOawy Kyp/fR2NdpZx50G7MErzXyOFiNFV7OuK4WwnRf64IkM/MKtIb9Lo4c3N5pHDcUAJ3BHh b9BA== X-Gm-Message-State: AOAM532r6DGewdMYZNyhchbhKBtr3cNaik1k7zwlwc0Wo3gcF1UBYElr m3J3deUHG1yQ/pD5gj+nCAE= X-Google-Smtp-Source: ABdhPJxqxbtAYrfeOp0i5Y6VI0WUxvK9Ffqa556l+runizWbvLX79qdr0h8W6jZw8/vRZjpGoNjESg== X-Received: by 2002:ac2:4308:: with SMTP id l8mr21608280lfh.342.1625688366946; Wed, 07 Jul 2021 13:06:06 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id k12sm1232234lfv.14.2021.07.07.13.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 13:06:06 -0700 (PDT) Date: Wed, 7 Jul 2021 23:06:05 +0300 From: Dmitry Kozlyuk To: John Levon Cc: anatoly.burakov@intel.com, dev@dpdk.org, levon@movementarian.org Message-ID: <20210707230605.58a79a47@sovereign> In-Reply-To: <20210625104449.2096166-1-john.levon@nutanix.com> References: <20210610210521.830303-1-john.levon@nutanix.com> <20210625104449.2096166-1-john.levon@nutanix.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH RESEND] eal: allow hugetlbfs sub-directories 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" 2021-06-25 11:44 (UTC+0100), John Levon: > get_hugepage_dir() was implemented in such a way that a --huge-dir option > had to exactly match the mountpoint, but there's no reason for this > restriction. Fix the implementation to allow a sub-directory within a > suitable hugetlbfs mountpoint to be specified. > > Signed-off-by: John Levon > --- > lib/eal/linux/eal_hugepage_info.c | 25 +++++++++++++++++++------ > 1 file changed, 19 insertions(+), 6 deletions(-) > > diff --git a/lib/eal/linux/eal_hugepage_info.c b/lib/eal/linux/eal_hugepage_info.c > index d97792cad..d7e9918f8 100644 > --- a/lib/eal/linux/eal_hugepage_info.c > +++ b/lib/eal/linux/eal_hugepage_info.c > @@ -226,16 +226,29 @@ get_hugepage_dir(uint64_t hugepage_sz, char *hugedir, int len) > default_size = get_default_hp_size(); > > while (fgets(buf, sizeof(buf), fd)){ > + const char *dir; > + > if (rte_strsplit(buf, sizeof(buf), splitstr, _FIELDNAME_MAX, > split_tok) != _FIELDNAME_MAX) { > RTE_LOG(ERR, EAL, "Error parsing %s\n", proc_mounts); > break; /* return NULL */ > } > > - /* we have a specified --huge-dir option, only examine that dir */ > - if (internal_conf->hugepage_dir != NULL && > - strcmp(splitstr[MOUNTPT], internal_conf->hugepage_dir) != 0) > - continue; > + dir = splitstr[MOUNTPT]; > + > + /* > + * If a --huge-dir option has been specified, only examine > + * mounts that contain that directory, and make sure to return > + * the directory, not the mount. > + */ > + if (internal_conf->hugepage_dir != NULL) { > + if (strncmp(internal_conf->hugepage_dir, > + splitstr[MOUNTPT], > + strlen(splitstr[MOUNTPT])) != 0) > + continue; > + > + dir = internal_conf->hugepage_dir; > + } Suppose there are /mnt/huge and /mnt/huge-2M mounted with -o pagesize=2M. If --huge-dir=/mnt/huge-2M is specified, this code will select /mnt/huge. The code would be shorter with `splitstr[MOUNTPT]` -> `dir`.