On 07/27/18 09:34 AM, Vakul Garg wrote: > > > > -----Original Message----- > > From: Dave Watson [mailto:davejwat...@fb.com] > > Sent: Thursday, July 26, 2018 2:31 AM > > To: Vakul Garg <vakul.g...@nxp.com> > > Cc: David Miller <da...@davemloft.net>; netdev@vger.kernel.org; > > bor...@mellanox.com; avia...@mellanox.com; Doron Roberts-Kedes > > <doro...@fb.com> > > 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.