lkml.org 
[lkml]   [2012]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: virtio(-scsi) vs. chained sg_lists (was Re: [PATCH] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list)
Il 30/07/2012 01:50, Rusty Russell ha scritto:
>> Also, being the first user of chained scatterlist doesn't exactly give
>> me warm fuzzies.
>
> We're far from the first user: they've been in the kernel for well over
> 7 years. They were introduced for the block layer, but they tended to
> ignore private uses of scatterlists like this one.

Yeah, but sg_chain has no users in drivers, only a private one in
lib/scatterlist.c. The internal API could be changed to something else
and leave virtio-scsi screwed...

> Yes, we should do this. But note that this means an iteration, so we
> might as well combine the loops :)

I'm really bad at posting pseudo-code, but you can count the number of
physically-contiguous entries at the beginning of the list only. So if
everything is contiguous, you use a single non-indirect buffer and save
a kmalloc. If you use indirect buffers, I suspect it's much less
effective to collapse physically-contiguous entries. More elaborate
heuristics do need a loop, though.

Paolo


\
 
 \ /
  Last update: 2012-07-30 10:01    [W:0.064 / U:1.092 seconds]
©2003-2014 Jasper Spaans. Advertise on this site