From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BA3A0A0471 for ; Fri, 19 Jul 2019 16:11:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F0AD22C2B; Fri, 19 Jul 2019 16:11:45 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id B5F912C17 for ; Fri, 19 Jul 2019 16:11:43 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2019 07:11:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,282,1559545200"; d="scan'208";a="176302620" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.251.81.9]) ([10.251.81.9]) by FMSMGA003.fm.intel.com with ESMTP; 19 Jul 2019 07:11:40 -0700 To: Olivier Matz , Vamsi Krishna Attunuru , dev@dpdk.org Cc: Andrew Rybchenko , Thomas Monjalon , Jerin Jacob Kollanukkaran , Kokkilagadda , Ferruh Yigit References: <20190719133845.32432-1-olivier.matz@6wind.com> <20190719133845.32432-5-olivier.matz@6wind.com> From: "Burakov, Anatoly" Message-ID: <1d3e5bb5-8289-ae3d-7bda-57ef76c350d1@intel.com> Date: Fri, 19 Jul 2019 15:11:40 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190719133845.32432-5-olivier.matz@6wind.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [RFC 4/4] mempool: prevent objects from being across pages 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 19-Jul-19 2:38 PM, Olivier Matz wrote: > When using iova contiguous memory and objets smaller than page size, > ensure that objects are not located across several pages. > > Signed-off-by: Vamsi Krishna Attunuru > Signed-off-by: Olivier Matz > --- > total_elt_sz = mp->header_size + mp->elt_size + mp->trailer_size; > > - for (off = 0, i = 0; off + total_elt_sz <= len && i < max_objs; i++) { > + for (off = 0, i = 0; i < max_objs; i++) { > + /* align offset to next page start if required */ > + if (mempool_check_obj_bounds((char *)vaddr + off, > + pg_sz, total_elt_sz) < 0) { > + off += RTE_PTR_ALIGN_CEIL((char *)vaddr + off, pg_sz) - > + ((char *)vaddr + off); Same here, PTR_ALIGN plus PTR_SUB. It's perhaps not as cool as a one-liner, but this is not a hot path :) -- Thanks, Anatoly