Re: [RFC PATCH] net: add dataref destructor to sk_buff

Gregory Haskins
2009-11-16T20:18:17Z

[-- Attachment #1: Type: text/plain, Size: 1833 bytes --]

Stephen Hemminger wrote:
> On Sat, 14 Nov 2009 00:27:46 -0500
> Gregory Haskins <gregory.haskins@gmail.com> wrote:
>
>> Stephen Hemminger wrote:

>
>>> People have tried doing copy-less send by page flipping, but the overhead of the IPI to
>>> invalidate the TLB exceeded the overhead of the copy. There was an Intel paper on this in
>>> at Linux Symposium (Ottawa) several years ago.
>> I think you are confusing copy-less tx with copy-less rx. You can try
>> to do copy-less rx with page flipping, which has the IPI/TLB thrashing
>> properties you mention, and I agree is problematic. We are talking
>> about copy-less tx here, however, and therefore no page-flipping is
>> involved. Rather, we are just posting SG lists of pages directly to the
>> NIC (assuming the nic supports HIGH_DMA, etc). You do not need to flip
>> the page, or invalidate the TLB (and thus IPI the other cores) to do
>> this to my knowledge.
>>
>
> If you want to do copy-less tx for all applications, you have to
> do COW to handle the trivial case of :
>
> while (cc = read(infd, buffer, sizeof buffer)) {
> send(outsock, buffer, cc);
> }
>
>

You certainly _could_ implement this as a COW I suppose, but that would
be insane. If someone did do this, you are right: you need TLB
invalidation.

However, if I were going to actually propose the changeover of the
system calls to use zero-copy (note that I am not), it would be based on
the concept in this patch. That is: the send() would block until the
NIC completes the DMA and the shinfo block is freed. Alternate
implementations would be AIO based, where the shinfo destructor
signifies the generation of the completion event.

FWIW: The latter is conceptually similar to how this is being used in
AlacrityVM.

HTH

Kind Regards,
-Greg

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 267 bytes --]