Re: problem in do_tcp_sendpages

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

 



David S. Miller wrote:
> > So when i try to free the page the page does not get freed resulting
> > in a kind of memory leak.
> 
> It gets freed later when the TCP send has completed at the
> device, and the other end has sent an ACK back to acknowledge
> the data.  Meanwhile the packet sits referenced in the TCP
> retransmit queue and cannot be freed.

That reminds me.  Is there a good (efficient) way to find out when
it's freed from userspace?

The reason I want this is:

   1. Call sendfile() on some portion of a data file.
   2. Later, I need to update portions of the data file, without affecting
      data that I already sent to the TCP stream.

Step 2 cannot be done until the pages queued by sendfile() have been
freed, because until then, data written in step 2 might be sent on the
wire.  Of course I could call send() but that would miss the
memory-saving and time-saving effects.

Alternatively, treating the file like a database with a "wandering
log" like reiser4, I can choose to write elsewhere in the file.  But
how do I know when it's safe to reuse the pages which I previously
queued with sendfile()?

I'm currently using ioctl(SIOCOUTQ), but that isn't great as I need to
poll it repeatedly to check for freeing progress.

Thanks,
-- 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