From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0090.outbound.protection.outlook.com [157.56.111.90]) by dpdk.org (Postfix) with ESMTP id 3ABF447CE for ; Wed, 1 Jun 2016 09:00:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=4r+dnWoMdob8Ju32AoHtDBgSACmhPbYq9Eh7Bw4Om1Q=; b=KYlaY7NEoWKz+JLZ8uV2QeuiC0tk+Db/NZj8T6eViP2tG7D/b4Zv48gO0TMjzFC6qU5FRxlsfq1HTtRn2tXE/DSARsKN7duUeFYThw9Ses2FlGLdZqqe+5ZdcrRFPGl80eDyK+nItpAFRo+2sAVHSpxrLhGqhiZD39/k9ZnC/M0= Authentication-Results: 6wind.com; dkim=none (message not signed) header.d=none;6wind.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain (111.93.218.67) by BLUPR0701MB1716.namprd07.prod.outlook.com (10.163.85.142) with Microsoft SMTP Server (TLS) id 15.1.506.9; Wed, 1 Jun 2016 07:00:46 +0000 Date: Wed, 1 Jun 2016 12:30:23 +0530 From: Jerin Jacob To: Olivier MATZ CC: , , , Message-ID: <20160601070018.GA26922@localhost.localdomain> References: <1464101442-10501-1-git-send-email-jerin.jacob@caviumnetworks.com> <1464250025-9191-1-git-send-email-jerin.jacob@caviumnetworks.com> <574BFD97.2010505@6wind.com> <20160531125822.GA10995@localhost.localdomain> <574DFC9A.2050304@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <574DFC9A.2050304@6wind.com> User-Agent: Mutt/1.6.1 (2016-04-27) X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MAXPR01CA0047.INDPRD01.PROD.OUTLOOK.COM (10.164.146.147) To BLUPR0701MB1716.namprd07.prod.outlook.com (10.163.85.142) X-MS-Office365-Filtering-Correlation-Id: 8b390646-24f9-4492-372f-08d389ea76a6 X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 2:CVk2Q/WNPcpEv62kuQx7q2gvLG6mhSH8OafiWjR7oHmdXyXHzUoo8kDj5PD48oJmgIopEprOzFcKcUq3q0XruQUh75KjRn65WtILtQtESmKC0cssVm1xQKHFrCj1NiM55Y72FtIWsqya8C3chzznfmrLPgQOJDVKSpg7GsP51fuxIC8JmXM6EUcVJ/8SxjgY; 3:BrE7kYrbp1HZgTbGupwepfnhS0bJfh1Oi/1qcW2HDwvs+N0+gSZIWQH/I241Vtew2qzNUD4UcGAjffhIW2RyHOFEa4x6Rat7gjhYdavKFDkRixE59LGLcTuKlHRvZmUT; 25:flO5aKsWRw2eMjTQu4q2FeWuSNs8yoqAGEUX2AbKuEXgJB/J6zmC+ANKPS4GDHTEqVhRIRSpIOXSgpvbmFgPBxai8HBfYNLgwAScL4rB6ecMtS+fTuXgcnainexqndQTa4hc/clNYKhcHF52QrmpAj7BhPc3NTu030u0vHpt2IdKzTvuWmek/hHpNXrzVvc86F2tGg5LQhliSWvGdTnIv39KgqXi33TJb6lyPU6/dujvtzvcg1qU6VPKOhTN2uGmmTtZjzV5SsdBkFqKcXxMDxfjeDYwBOsx5NBAnG+k0wXjNzPjYK5N2m96AFGxS6thuh6IkKooMh6NOYIpcz4xKTp7XuxI45RHJGbufDKuVMrh1QZ/LaZnMWQq6IIY6x9K/oqC6X4MW324XbUuXUGnHEfTgGRgaXrZPWv3vhgTVHI= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0701MB1716; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 20:1YUoLD/3mZkEGXw6epQQtl2ItqiUo2GIwO3SmhlZWTo2HxCUYgJ+HcVdvN+AwQ7aKDvUDSLMqTtYBUdBwF7zaUJp+fwHxTRniiuEsFTrow76IHmz0Ej6iipadF1t4LuTxaSU/eJcFINoNzTL4fTjW/xwe1YoGMePniGDUzbtQeNv4zel9Ov430S6Gr9LaPSXnc2W+dcYH6F3vjq3hI0kphqt8knPVgn8ipy2ArdnryMJDFVeYuHYUU3lVSi1A0s8Zk71pD1JdwEdtWATVRxNApmrY7sLQhdjlMXrULViEJ2yb5wgADBEDLB9gntP28ulf+j1ESvx6qVvQ1qYkcZpSY2CKQyXr5MxhypTbZQvyXhZnmfAYr1WE0CeQOM3wTjT/sHVSC9Ec8ZRoFLRP5By3uQMAK2uce9lnYMlC65/NO7xFyvEghFrHydBwciTlhtADOFeDnWpHdxJb+w6wKrNVdy1cgpD1Tp1RTeFCi0NAEUpjdzrHM3dtTZsLfI1CoX8o48Iw8S8PciOwmXElhPjJx+83HHtULCvA1OnYPhm6oFaW4JpcMAC6smL03vZbu3no6ucfw7OTwGyUm10bworynLxq5XtHwzmjMdGpVfYd6Q= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(131327999870524)(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:BLUPR0701MB1716; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1716; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 4:btbd2TcxmBMM1h2L44HPtz8TPj5J8q2Awua9ysm2cBEubD2x/M96yMWlCCoJ3GrTNOX9389nJ3Uf8SsRIHPeG8sD66QR5mGFjMuSYo+ZhnwXW9m9fKE2dV/v4KtZ5rKjrpZX0TPSGmpNaZGLnRQUWDfM318kZg9sQEjuccLQMOrnXHSEE44UNdkDaRsSVNJuFZ9w/4bOxk7UADEc/IcMHaZZybPkqXXtnlMZrizfA1hDCwcOszUKL3fX7+RCwsuaLR5/tAQ1TJhEoUExdGG4eObh0FbshNHvLGKl1c5+YfygL22746N7MkO3RYnXmojNil2rS9587YpE2QKpyEQHcdPMAUluHAZstC/iwcJZp0uwrl+1/NACGReupsefYMEeBJG/byEsAZ/8Pm2x7uZmftCp4ZjaETSzg/ScZ9M1chCij8sjIsamoufoKbz4cLGa X-Forefront-PRVS: 096029FF66 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(24454002)(76104003)(42186005)(66066001)(586003)(189998001)(5009440100003)(9686002)(46406003)(47776003)(50466002)(61506002)(110136002)(4326007)(8676002)(97756001)(33656002)(2906002)(81166006)(5004730100002)(2950100001)(93886004)(92566002)(1076002)(6116002)(77096005)(50986999)(76176999)(54356999)(23726003)(3846002)(4001350100001)(83506001)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1716; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1716; 23:GzEK+RWkTAMRGkqQRGHMe8iD5+ODVZfQ7XUZjNR?= =?us-ascii?Q?1G2AfuA5wbmGHQXhKPb5DT9jcsN1dQipyYOdfI/L18ZCgCnjD2qoe/XkUhEs?= =?us-ascii?Q?UYhCL+frIl7BwwBFA+VEruL9OMnfz+sa05S6WNT4K+rTj84+40YZH2STLj95?= =?us-ascii?Q?rMdDod5R2Xl8RYGLroRRBABfHShPOa9wnSYIYxB9m88xy2VtkWuwipskWMKH?= =?us-ascii?Q?1v1TgycicNXaINqcF5LP8WuZL1OepmwnSq0nnd/bxKyTjDjzkJXphkGOqxIH?= =?us-ascii?Q?rvjrKNFBJSC0P9XKKZbcb8FD0i/upnue2vJHEGfCAxZ/vEYX7PuRUw5woWe/?= =?us-ascii?Q?BohxK8raazYya/56sQga7uq3IJ/xJn0AWfXAI7VI9rPOuZ4B8iXwJ3B8KeEU?= =?us-ascii?Q?LSImStla8QZAdUzmao+xTXfXoexwzX9Lh5ouYRT8zlRwUY9stqLqoXRttIln?= =?us-ascii?Q?6qDpfw+B6OiIwKPUHJyDP1m8u7dOWAhsdXk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O+C4wOSQDuehD/KsTj0XHEMAZ4m6ZE8rsMcYxxS SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2016 07:00:46.4390 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1716 Subject: Re: [dpdk-dev] [PATCH v2] mempool: replace c memcpy code semantics with optimized rte_memcpy X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2016 07:00:51 -0000 On Tue, May 31, 2016 at 11:05:30PM +0200, Olivier MATZ wrote: > Hi Jerin, Hi Olivier, > > >>> /* Add elements back into the cache */ > >>> - for (index = 0; index < n; ++index, obj_table++) > >>> - cache_objs[index] = *obj_table; > >>> + rte_memcpy(&cache_objs[0], obj_table, sizeof(void *) * n); > >>> > >>> cache->len += n; > >>> > >>> > >> > >> I also checked in the get_bulk() function, which looks like that: > >> > >> /* Now fill in the response ... */ > >> for (index = 0, len = cache->len - 1; > >> index < n; > >> ++index, len--, obj_table++) > >> *obj_table = cache_objs[len]; > >> > >> I think we could replace it by something like: > >> > >> rte_memcpy(obj_table, &cache_objs[len - n], sizeof(void *) * n); > >> > >> The only difference is that it won't reverse the pointers in the > >> table, but I don't see any problem with that. > >> > >> What do you think? > > > > In true sense, it will _not_ be LIFO. Not sure about cache usage implications > > on the specific use cases. > > Today, the objects pointers are reversed only in the get(). It means > that this code: > > rte_mempool_get_bulk(mp, table, 4); > for (i = 0; i < 4; i++) > printf("obj = %p\n", t[i]); > rte_mempool_put_bulk(mp, table, 4); > > > printf("-----\n"); > rte_mempool_get_bulk(mp, table, 4); > for (i = 0; i < 4; i++) > printf("obj = %p\n", t[i]); > rte_mempool_put_bulk(mp, table, 4); > > prints: > > addr1 > addr2 > addr3 > addr4 > ----- > addr4 > addr3 > addr2 > addr1 > > Which is quite strange. IMO, It is the expected LIFO behavior. Right ? What is not expected is the following, which is the case after change. Or Am I missing something here? addr1 addr2 addr3 addr4 ----- addr1 addr2 addr3 addr4 > > I don't think it would be an issue to replace the loop by a > rte_memcpy(), it may increase the copy speed and it will be > more coherent with the put(). > > > Olivier