Re: Proposal: merged system calls

Alan Cox (alan@cymru.net)
Mon, 20 May 1996 09:46:23 +0100 (BST)


> what we should have for performance in terms of networking is an API
> that would allow the buffers used for send/recv to be remapped into
> kernel space

You already can. The low level sk_buff code is perfectly capable of handling
such "loan out" buffers. There isnt a routine to do map/lock or the actually
"alloc_loan_skb", but the rest was thought off.

> we could then redefine sk_buff to have a small header area and a
> pointer to the remapped pages. This would make Linux networking really
> fly.

No. You see two things come out and bite you.

1. The MMU on some processors is horribly slow when you reload page
tables. On SMP machines you may have to take a cross processor IPI (inter
processor interrupt) to do it which is _slow_.

2. Even for large blocks where it looks promising you then get caught
out in the IP case because a copy and checksum is the same speed as a copy
on almost all current architectures.

Now buffer flipping with mmap is a win if you have stuff like some SGI's do
where the hardware generates IP/UDP/TCP checksums. Its not a win on PC
cards. Werner Almesberger has code for doing this for raw AAL5 on ATM.

We do have two places we could in theory optimise. Firstly doing direct
user space to device driver loading of buffers [horribly hard], and secondly
pulling packets from the kernel direct into user space on interrupt [foul]

There are other semantics that can be used for this kind of fast message
pass using virtual memory traps for shared-VM. We could postulate an mmap()
interface to sockets as well.

Alan