From: David Miller <davem@davemloft.net>
To: mingo@elte.hu
Cc: wenji@fnal.gov, akpm@osdl.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [patch 1/4] - Potential performance bottleneck for Linxu TCP
Date: Wed, 29 Nov 2006 22:30:55 -0800 (PST) [thread overview]
Message-ID: <20061129.223055.05159325.davem@davemloft.net> (raw)
In-Reply-To: <20061130061758.GA2003@elte.hu>
From: Ingo Molnar <mingo@elte.hu>
Date: Thu, 30 Nov 2006 07:17:58 +0100
>
> * David Miller <davem@davemloft.net> wrote:
>
> > We can make explicitl preemption checks in the main loop of
> > tcp_recvmsg(), and release the socket and run the backlog if
> > need_resched() is TRUE.
> >
> > This is the simplest and most elegant solution to this problem.
>
> yeah, i like this one. If the problem is "too long locked section", then
> the most natural solution is to "break up the lock", not to "boost the
> priority of the lock-holding task" (which is what the proposed patch
> does).
Ingo you're mis-read the problem :-)
The issue is that we actually don't hold any locks that prevent
preemption, so we can take preemption points which the TCP code
wasn't designed with in-mind.
Normally, we control the sleep point very carefully in the TCP
sendmsg/recvmsg code, such that when we sleep we drop the socket
lock and process the backlog packets that accumulated while the
socket was locked.
With pre-emption we can't control that properly.
The problem is that we really do need to run the backlog any time
we give up the cpu in the sendmsg/recvmsg path, or things get real
erratic. ACKs don't go out as early as we'd like them to, etc.
It isn't easy to do generically, perhaps, because we can only
drop the socket lock at certain points and we need to do that to
run the backlog.
This is why my suggestion is to preempt_disable() as soon as we
grab the socket lock, and explicitly test need_resched() at places
where it is absolutely safe, like this:
if (need_resched()) {
/* Run packet backlog... */
release_sock(sk);
schedule();
lock_sock(sk);
}
The socket lock is just a by-hand binary semaphore, so it doesn't
block pre-emption. We have to be able to sleep while holding it.
next prev parent reply other threads:[~2006-11-30 6:30 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-30 1:56 Wenji Wu
2006-11-30 2:19 ` David Miller
2006-11-30 6:17 ` Ingo Molnar
2006-11-30 6:30 ` David Miller [this message]
2006-11-30 6:47 ` Ingo Molnar
2006-11-30 7:12 ` David Miller
2006-11-30 7:35 ` Ingo Molnar
2006-11-30 9:52 ` Evgeniy Polyakov
2006-11-30 10:07 ` Nick Piggin
2006-11-30 10:22 ` Evgeniy Polyakov
2006-11-30 10:32 ` Ingo Molnar
2006-11-30 17:04 ` Wenji Wu
2006-11-30 20:20 ` Ingo Molnar
2006-11-30 20:58 ` Wenji Wu
2006-11-30 20:22 ` David Miller
2006-11-30 20:30 ` Ingo Molnar
2006-11-30 20:38 ` David Miller
2006-11-30 20:49 ` Ingo Molnar
2006-11-30 20:54 ` Ingo Molnar
2006-11-30 20:55 ` David Miller
2006-11-30 20:14 ` David Miller
2006-11-30 20:42 ` Wenji Wu
2006-12-01 9:53 ` Evgeniy Polyakov
2006-12-01 23:18 ` David Miller
2006-11-30 6:56 ` Ingo Molnar
2006-11-30 16:08 ` Wenji Wu
2006-11-30 20:06 ` David Miller
2006-11-30 9:33 ` Christoph Hellwig
2006-11-30 16:51 ` Lee Revell
-- strict thread matches above, loose matches on Subject: below --
2006-11-30 2:02 Wenji Wu
2006-11-30 6:19 ` Ingo Molnar
2006-11-29 23:27 [Changelog] " Wenji Wu
2006-11-29 23:28 ` [patch 1/4] " Wenji Wu
2006-11-30 0:53 ` David Miller
2006-11-30 1:08 ` Andrew Morton
2006-11-30 1:13 ` David Miller
2006-11-30 6:04 ` Mike Galbraith
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=20061129.223055.05159325.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=netdev@vger.kernel.org \
--cc=wenji@fnal.gov \
/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
all inboxes | Powered by JetHome®