From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Watson Subject: Re: [net-next v5 3/3] net/tls: Remove redundant array allocation. Date: Fri, 27 Jul 2018 08:38:46 -0700 Message-ID: <20180727153846.GA25541@davejwatson-mba.local.dhcp.thefacebook.com> References: <20180719162613.27184-1-vakul.garg@nxp.com> <20180719162613.27184-4-vakul.garg@nxp.com> <20180721.192532.520509909556885779.davem@davemloft.net> <20180723163509.GA91424@davejwatson-mba.local> <20180725210103.GA74476@davejwatson-mba.dhcp.thefacebook.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: David Miller , "netdev@vger.kernel.org" , "borisp@mellanox.com" , "aviadye@mellanox.com" , Doron Roberts-Kedes To: Vakul Garg Return-path: Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:42480 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732148AbeG0RB3 (ORCPT ); Fri, 27 Jul 2018 13:01:29 -0400 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On 07/27/18 09:34 AM, Vakul Garg wrote: > > > > -----Original Message----- > > From: Dave Watson [mailto:davejwatson@fb.com] > > Sent: Thursday, July 26, 2018 2:31 AM > > To: Vakul Garg > > Cc: David Miller ; netdev@vger.kernel.org; > > borisp@mellanox.com; aviadye@mellanox.com; Doron Roberts-Kedes > > > > Subject: Re: [net-next v5 3/3] net/tls: Remove redundant array allocation. > > > > On 07/24/18 08:22 AM, Vakul Garg wrote: > > > Will it be a bad idea to get rid of array 'sgin' on stack and simply > > > kmalloc 'sgin' for whatever the number the number of pages returned by > > iov_iter_npages()? > > > We can allocate for sgout too with the same kmalloc(). > > > > > > (Using a local array based 'sgin' is coming in the way to achieve > > > sending multiple async record decryption requests to the accelerator > > > without waiting for previous one to complete.) > > > > Yes we could do this, and yes we would need to heap allocate if you want to > > support multiple outstanding decryption requests. I think async crypto > > prevents any sort of zerocopy-fastpath, however. > > We already do a aead_request_alloc (which internally does kmalloc). > To mitigate the cost of kmalloc/kfree for sg lists and aad, I am allocating a > combined memory chunk for all of these and then segmenting it into > aead_req, aad, sgin, sgout. This way there should be no extra cost for > memory allocations in non-async. Makes sense, sounds good to me.