public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@argo.co.il>
To: "David S. Miller" <davem@davemloft.net>
Cc: galibert@pobox.com, linux-kernel@vger.kernel.org
Subject: Re: tcp_sendpage and page allocation lifetime vs. iscsi
Date: Mon, 25 Apr 2005 22:43:19 +0300	[thread overview]
Message-ID: <426D4857.6080004@argo.co.il> (raw)
In-Reply-To: <20050425121953.6b5c3278.davem@davemloft.net>

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.


  reply	other threads:[~2005-04-25 19:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-25 17:02 tcp_sendpage and page allocation lifetime vs. iscsi Olivier Galibert
2005-04-25 19:11 ` Avi Kivity
2005-04-25 19:19   ` David S. Miller
2005-04-25 19:43     ` Avi Kivity [this message]
2005-04-25 19:37       ` David S. Miller
2005-04-25 22:06     ` Olivier Galibert
2005-04-25 22:08       ` David S. Miller
2005-04-25 22:31         ` Olivier Galibert
2005-04-29 17:09         ` Dmitry Yusupov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=426D4857.6080004@argo.co.il \
    --to=avi@argo.co.il \
    --cc=davem@davemloft.net \
    --cc=galibert@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox