lkml.org 
[lkml]   [2021]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 09/16] dma-direct: Support PCI P2PDMA pages in dma-direct map_sg
From
Date
On 5/3/21 10:04 AM, Logan Gunthorpe wrote:
> Oops missed a comment:
>
> On 2021-05-02 5:28 p.m., John Hubbard wrote:
>>> int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
>>> enum dma_data_direction dir, unsigned long attrs)
>>> {
>>> - int i;
>>> + struct pci_p2pdma_map_state p2pdma_state = {};
>>
>> Is it worth putting this stuff on the stack--is there a noticeable
>> performance improvement from caching the state? Because if it's
>> invisible, then simplicity is better. I suspect you're right, and that
>> it *is* worth it, but it's good to know for real.
>
> I haven't measured it (it would be hard to measure), but I think it's
> fairly clear here. Without the state, xa_load() would need to be called
> on *every* page in an SGL that maps only P2PDMA memory from one device.
> With the state, it only needs to be called once. xa_load() is cheap, but
> it is not that cheap.

OK, thanks for spelling it out for me. :)

>
> There's essentially the same optimization in get_user_pages for
> ZONE_DEVICE pages. So, if it is necessary there, it should be necessary
> here.
>

Right, that's a pretty solid example.

thanks,
--
John Hubbard
NVIDIA

\
 
 \ /
  Last update: 2021-05-04 02:02    [W:0.100 / U:0.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site