Skip to contentSkip to conversation

Optimizing linux applications with the help of the kernel.

PATCH In review Amit Choudhary 4 participants 4 messages Dec 10, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Optimizing linux applications with the help of the kernel.

Hi All,

I just had an idea for improving the performance of linux applications with some help from the kernel. Let's say that I have to make a copy of a file. So, I read the input file into a buffer and then write the buffer to the output file.

In both these cases the same data is coming from kernel_to_user and then from user_to_kernel. If this can be short-circuited, that is, from kernel_to_kernel then the performance can be increased a lot.

The psuedocode would be:

fd_inp = open _output_file
fd_out = open _input_file
instruct_kernel to write next data read from fd_inp to fd_out read fd_out

The same mechanism can be applied to many other scenarios.
May be whatever I am thinking is wrong or involves lot of complexities but this is just a thought.

Regards,
Amit

____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

#1 lore raw
Quoted 3 lines · Amit Choudhary

In both these cases the same data is coming from kernel_to_user and then from user_to_kernel. If this can be short-circuited, that is, from kernel_to_kernel then the performance can be increased a lot.

Google on 'splice linux'. It can't do what you want right now exactly, but it might.

Signature · 2 lines
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://netherlabs.nl              Open and Closed source services
#2 lore raw
In reply to Amit Choudhary
Quoted 10 lines · Amit Choudhary

Hi All,

I just had an idea for improving the performance of linux applications with some help from the kernel. Let's say that I have to make a copy of a file. So, I read the input file into a buffer and then write the buffer to the output file.

In both these cases the same data is coming from kernel_to_user and then from user_to_kernel. If this can be short-circuited, that is, from kernel_to_kernel then the performance can be increased a lot.

Quoted 8 lines

The psuedocode would be:

fd_inp = open _output_file
fd_out = open _input_file
instruct_kernel to write next data read from fd_inp to fd_out read fd_out

I think you are describing the splice syscall:

see http://lwn.net/Articles/178199/

regards,

Benoit

#3 lore raw
In reply to Amit Choudhary
Quoted 10 lines · Amit Choudhary

Hi All,

I just had an idea for improving the performance of linux applications with some help from the kernel. Let's say that I have to make a copy of a file. So, I read the input file into a buffer and then write the buffer to the output file.

In both these cases the same data is coming from kernel_to_user and then from user_to_kernel. If this can be short-circuited, that is, from kernel_to_kernel then the performance can be increased a lot.

See the linux specific splice() syscall - "man 2 splice".

Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html