Re: Possible improvement to pipe throughput

David S. Miller (
Fri, 27 Sep 1996 05:57:14 -0400

From: (Malcolm Beattie)
Date: 26 Sep 1996 14:50:31 GMT

For a pipe_read of the whole buffered page, instead of just using
memcpy_to_fs, one could just tweak the page table to swap the
virtual-to-physical mappings for the two pages. That way, instead
of incurring the cost of actually copying the data, you incur the
cost of a page table tweak. Since the kernel doesn't need the data
again, it doesn't matter that the new PIPEBASE points to junk (what
used to be the current task's page). You may need force a page-in
first (in case the user's page is paged out) but in general the
page would be in memory already.

You are stumbling upon a known technique called "page flipping". It
is already in common use for things such as "intelligent" networking
hardware. For example, for high speed networking like HIPPI where you
do _not_ want to have the processor touch the data ever, the HIPPI
board will do the checksumming and everything. Now to make this a
reality, one needs to have mechanisms whereby the page is "flipped"
into userspace and never copied there by the kernel until the user
writes to it or whatever.

Implementing this for the pipe case might be useful, it will give us a
better idea how difficult page flipping in the networking layer will
be for us to implement.

David S. Miller