The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: David Schwartz <davids@webmaster.com>
To: <folkert@vanheusden.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: RE: TCP memory pressure question
Date: Sat, 23 Nov 2002 14:54:12 -0800	[thread overview]
Message-ID: <20021123225414.AAA6403@shell.webmaster.com@whenever> (raw)
In-Reply-To: <001701c29340$749e8110$3640a8c0@boemboem>


On Sat, 23 Nov 2002 23:34:15 +0100, Folkert van Heusden wrote:

>What about:

>int WRITE(int handle, char *whereto, int len)
>{
>int cnt=len;
>
>while(len>0)
>{
>int rc;
>
>rc = write(handle, whereto, len);
>
>if (rc == -1)
>{
>if (errno == EINTR)
>                {
>                    /* just try again */
>                }
>                else if (errno == EAGAIN)
>                {
>                    /* give up time-slice */
>                    if (sched_yield() == -1)
>                    {

	By yielding your time slice, you prevent yourself from performing any 
'read's. So what's going to fix the memory pressure?

	There are two cases where this could work:

	1) For an application that uses very little TCP memory. By yielding, perhaps 
some other process will come along, a more heavy TCP memory user, and fix the 
problem.

	2) For an application that uses a thread-per-connection architecture. By 
yielding, we give other threads a chance to run and hope that they will 
relieve the memory pressure.

	But for a poll/select loop application that is heavily using TCP memory, 
this makes things worse. By stopping our own execution, we delay the time 
when we'll do 'read's. So we extend the TCP memory pressure problem for even 
longer.

	DS



  reply	other threads:[~2002-11-23 22:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-21 21:34 TCP memory pressure question David Schwartz
2002-11-22 12:06 ` Gianni Tedesco
2002-11-22 20:28   ` David Schwartz
2002-11-23  0:06     ` Jamie Lokier
2002-11-23  0:28       ` David Schwartz
2002-11-23 22:34         ` Folkert van Heusden
2002-11-23 22:54           ` David Schwartz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-11-22  1:27 Nivedita Singhvi
2002-11-22  9:18 ` Alex Riesen

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=20021123225414.AAA6403@shell.webmaster.com@whenever \
    --to=davids@webmaster.com \
    --cc=folkert@vanheusden.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