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
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux