Re: problem in do_tcp_sendpages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David S. Miller wrote:
> From: Jamie Lokier <jamie@xxxxxxxxxxxxx>
> Date: Thu, 22 Dec 2005 20:54:41 +0000
> 
> > That reminds me.  Is there a good (efficient) way to find out when
> > it's freed from userspace?
> 
> One way would be to use the SIOCOUTQ ioctl on the TCP socket.
> This states how many un-ACK'd (and thus unfree'd) bytes remain
> in the send queue.
> 
> So, for example, let's say you did two 1K sends, and you just want to
> know when the first 1K is reusable.  To do that, just wait for
> SIOCOUTQ to return 1K.

I am using that.  (What a shame only Linux has it!  Lots of OSes have
a variant of sendfile()).

But if I have thousands of sockets with outgoing data, those SIOCOUTQ
calls are a problem because they have to be polled: there's no
efficient way to find out _which_ pages are freed up without polling
all the sockets repeatedly.

I guess there is no good answer.

A variant on my problem is when using sendfile() to send from a
shared-memory file.  The idea is to prepare data in mapped shared
memory, and then sendfile() it so that it doesn't have to be copied
out from userspace.  I haven't actually tried this, but I think it
might improve performance where large blocks of data are involved,
especially when the same data is sent on many sockets (e.g. cached
generated web pages), and certainly would reduce memory usage.

It has the same problem: when to recycle pages in userspace.

-- Jamie

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux