From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 992F8A05D3
	for <public@inbox.dpdk.org>; Mon, 25 Mar 2019 10:04:40 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id C10792BF7;
	Mon, 25 Mar 2019 10:04:39 +0100 (CET)
Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com
 [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id D57A7239
 for <dev@dpdk.org>; Mon, 25 Mar 2019 10:04:38 +0100 (CET)
X-Virus-Scanned: Proofpoint Essentials engine
Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits))
 (No client certificate requested)
 by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id
 2A67C9C005B; Mon, 25 Mar 2019 09:04:37 +0000 (UTC)
Received: from [192.168.38.17] (91.220.146.112) by ukex01.SolarFlarecom.com
 (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 25 Mar
 2019 09:04:29 +0000
To: Xiaolong Ye <xiaolong.ye@intel.com>, <dev@dpdk.org>, David Marchand
 <david.marchand@redhat.com>
CC: Qi Zhang <qi.z.zhang@intel.com>, Karlsson Magnus
 <magnus.karlsson@intel.com>, Topel Bjorn <bjorn.topel@intel.com>, "Maxime
 Coquelin" <maxime.coquelin@redhat.com>, Stephen Hemminger
 <stephen@networkplumber.org>, Ferruh Yigit <ferruh.yigit@intel.com>, "Luca
 Boccassi" <bluca@debian.org>, Bruce Richardson <bruce.richardson@intel.com>,
 Ananyev Konstantin <konstantin.ananyev@intel.com>, Olivier Matz
 <olivier.matz@6wind.com>
References: <20190301080947.91086-1-xiaolong.ye@intel.com>
 <20190325060400.40291-1-xiaolong.ye@intel.com>
 <20190325060400.40291-4-xiaolong.ye@intel.com>
From: Andrew Rybchenko <arybchenko@solarflare.com>
Message-ID: <3ee92f43-eabf-7a97-dc3a-3669023edeff@solarflare.com>
Date: Mon, 25 Mar 2019 12:04:24 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.5.1
MIME-Version: 1.0
In-Reply-To: <20190325060400.40291-4-xiaolong.ye@intel.com>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Content-Language: en-GB
X-Originating-IP: [91.220.146.112]
X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To
 ukex01.SolarFlarecom.com (10.17.10.4)
X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24510.003
X-TM-AS-Result: No-8.183200-8.000000-10
X-TMASE-MatchedRID: wQVy7q402w0OwH4pD14DsPHkpkyUphL9Xs5nqGvDCfMUtdRZTmEaIXB4
 4IkzjfYyF8NKa4AxCmCFxEOJpXwK3ZiLbpSaDQLh5O5PclyYqqoMkbIeqnhWfCb+z7wDyjZGeIm
 lnpvu90DiChHdKyzZ15GTpe1iiCJq71zr0FZRMbBWdFebWIc3VsRB0bsfrpPInxMyeYT53RkRZv
 bCfPKvWoJpq9R0z0IxXkapDvDpOlU9MVKFbs8dKJk+LOBhhegrwi3835MJQtXxb79XVkzBIgp+q
 RpOYdKqlzcT7KrzpcTUNewp4E2/TgSpmVYGQlZ3sxk1kV1Ja8cbbCVMcs1jUlZca9RSYo/b
X-TM-AS-User-Approved-Sender: Yes
X-TM-AS-User-Blocked-Sender: No
X-TMASE-Result: 10--8.183200-8.000000
X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24510.003
X-MDID: 1553504678-xm1DHgbuPjT6
Subject: Re: [dpdk-dev] [PATCH v5 3/5] lib/mempool: allow page size aligned
 mempool
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190325090424.jepy1PVkFFfg4CQM4Kd6cTqSRWKzbVIaWsaq9i9nlWc@z>

On 3/25/19 9:03 AM, Xiaolong Ye wrote:
> Allow create a mempool with page size aligned base address.
>
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
> ---
>   lib/librte_mempool/rte_mempool.c | 3 +++
>   lib/librte_mempool/rte_mempool.h | 1 +
>   2 files changed, 4 insertions(+)
>
> diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
> index 683b216f9..171ba1057 100644
> --- a/lib/librte_mempool/rte_mempool.c
> +++ b/lib/librte_mempool/rte_mempool.c
> @@ -543,6 +543,9 @@ rte_mempool_populate_default(struct rte_mempool *mp)
>   		if (try_contig)
>   			flags |= RTE_MEMZONE_IOVA_CONTIG;
>   
> +		if (mp->flags & MEMPOOL_F_PAGE_ALIGN)
> +			align = RTE_MAX(align, (size_t)getpagesize());
> +
>   		mz = rte_memzone_reserve_aligned(mz_name, mem_size,
>   				mp->socket_id, flags, align);
>   
> diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h
> index 7c9cd9a2f..75553b36f 100644
> --- a/lib/librte_mempool/rte_mempool.h
> +++ b/lib/librte_mempool/rte_mempool.h
> @@ -264,6 +264,7 @@ struct rte_mempool {
>   #define MEMPOOL_F_POOL_CREATED   0x0010 /**< Internal: pool is created. */
>   #define MEMPOOL_F_NO_IOVA_CONTIG 0x0020 /**< Don't need IOVA contiguous objs. */
>   #define MEMPOOL_F_NO_PHYS_CONTIG MEMPOOL_F_NO_IOVA_CONTIG /* deprecated */
> +#define MEMPOOL_F_PAGE_ALIGN     0x0040 /**< Chunk's base address is page aligned */

For me it sounds like mempool objects should be page aligned since
MEMPOOL_F_NO_SPREAD, MEMPOOL_F_NO_CACHE_ALIGN and
MEMPOOL_F_NO_IOVA_CONTIG say about object properties, not chunk.

Personally I doubt that the final goal is just having chunk page aligned.

Andrew.