[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <501633EA.603@redhat.com>
Date: Mon, 30 Jul 2012 09:12:42 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Rusty Russell <rusty@...tcorp.com.au>
CC: Boaz Harrosh <bharrosh@...asas.com>,
Wang Sen <senwang@...ux.vnet.ibm.com>,
linux-scsi@...r.kernel.org, JBottomley@...allels.com,
stefanha@...ux.vnet.ibm.com, mc@...ux.vnet.ibm.com,
linux-kernel@...r.kernel.org,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
Subject: Re: 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists