lkml.org 
[lkml]   [2005]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: tcp_sendpage and page allocation lifetime vs. iscsi
David S. Miller wrote:

>On Mon, 25 Apr 2005 22:11:16 +0300
>Avi Kivity <avi@argo.co.il> wrote:
>
>
>
>>you need a completion to tell you when your buffer has been sent. you
>>can use the kiocb parameter to tcp_sendmsg, as it has a completion.
>>however, tcp_sendmsg does not appear to use it.
>>
>>in effect, you need tcp aio, but the mainline kernel does not support it
>>yet.
>>
>>
>
>Or, he could simply not try to reuse the private buffer he is
>giving to TCP.
>
>
you are describing a memory leak. at some point he must free (or
otherwise reuse) these pages.

theoretically he could peek at the tcp sequence number, but an
event-driven, protocol-agnostic completion seems better to me.

* light goes on *

yes, if he frees the pages immediately after tcp_sendpage, then the
reference count would remain elevated until tcp completes sending these
pages. so the sequence

allocate pages
fill with data
tcp_sendpage()
free pages

should be safe?

(I am still wishing for tcp aio, though)

--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-04-25 21:47    [W:0.057 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site