RE: Network slowdown due to CFS

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Schwartz
Date: Monday, October 1, 2007 - 9:49 am

> * Jarek Poplawski <jarkao2@o2.pl> wrote:


It can occasionally be an optimization. You may have a case where you can do
something very efficiently if a lock is not held, but you cannot afford to
wait for the lock to be released. So you check the lock, if it's held, you
yield and then check again. If that fails, you do it the less optimal way
(for example, dispatching it to a thread that *can* afford to wait).

It is also sometimes used in the implementation of spinlock-type primitives.
After spinning fails, yielding is tried.

I think it's also sometimes appropriate when a thread may monopolize a
mutex. For example, consider a rarely-run task that cleans up some expensive
structures. It may need to hold locks that are only held during this complex
clean up.

One example I know of is a defragmenter for a multi-threaded memory
allocator, and it has to lock whole pools. When it releases these locks, it
calls yield before re-acquiring them to go back to work. The idea is to "go
to the back of the line" if any threads are blocking on those mutexes.

There are certainly other ways to do these things, but I have seen cases
where, IMO, yielding was the best solution. Doing nothing would have been
okay too.


Can you explain what the current sched_yield behavior *is* for CFS and what
the tunable does to change it?

The desired behavior is for the current thread to not be rescheduled until
every thread at the same static priority as this thread has had a chance to
be scheduled.

Of course, it's not clear exactly what a "chance" is.

The semantics with respect to threads at other static priority levels is not
clear. Ditto for SMP issues. It's also not clear whether threads that yield
should be rewarded or punished for doing so.

DS


-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Network slowdown due to CFS, Martin Michlmayr, (Wed Sep 26, 1:52 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Wed Sep 26, 2:34 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Wed Sep 26, 2:47 am)
Re: Network slowdown due to CFS, Martin Michlmayr, (Wed Sep 26, 3:08 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Wed Sep 26, 3:18 am)
Re: Network slowdown due to CFS, Mike Galbraith, (Wed Sep 26, 3:20 am)
Re: Network slowdown due to CFS, Mike Galbraith, (Wed Sep 26, 3:23 am)
Re: Network slowdown due to CFS, Martin Michlmayr, (Wed Sep 26, 3:48 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Wed Sep 26, 4:21 am)
Re: Network slowdown due to CFS, Martin Michlmayr, (Wed Sep 26, 4:29 am)
RE: Network slowdown due to CFS, David Schwartz, (Wed Sep 26, 5:00 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Wed Sep 26, 6:31 am)
Re: Network slowdown due to CFS, Stephen Hemminger, (Wed Sep 26, 8:40 am)
Re: Network slowdown due to CFS, Stephen Hemminger, (Wed Sep 26, 8:46 am)
Re: Network slowdown due to CFS, Jarek Poplawski, (Thu Sep 27, 2:30 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Thu Sep 27, 2:46 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Thu Sep 27, 2:49 am)
Re: Network slowdown due to CFS, Martin Michlmayr, (Thu Sep 27, 3:54 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Thu Sep 27, 3:56 am)
Re: Network slowdown due to CFS, Martin Michlmayr, (Thu Sep 27, 4:12 am)
Re: Network slowdown due to CFS, Jarek Poplawski, (Thu Sep 27, 5:27 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Thu Sep 27, 6:31 am)
Re: Network slowdown due to CFS, Jarek Poplawski, (Thu Sep 27, 7:42 am)
Re: Network slowdown due to CFS, Nick Piggin, (Thu Sep 27, 11:10 pm)
Re: Network slowdown due to CFS, Jarek Poplawski, (Mon Oct 1, 1:43 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Mon Oct 1, 9:25 am)
RE: Network slowdown due to CFS, David Schwartz, (Mon Oct 1, 9:49 am)
Re: Network slowdown due to CFS, Chris Friesen, (Mon Oct 1, 9:55 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Mon Oct 1, 10:09 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Mon Oct 1, 10:31 am)
Re: Network slowdown due to CFS, Chris Friesen, (Mon Oct 1, 10:45 am)
RE: Network slowdown due to CFS, David Schwartz, (Mon Oct 1, 11:23 am)
Re: iperf yield usage, Ingo Molnar, (Mon Oct 1, 12:09 pm)
Re: Network slowdown due to CFS, Arjan van de Ven, (Mon Oct 1, 12:53 pm)
RE: Network slowdown due to CFS, David Schwartz, (Mon Oct 1, 3:17 pm)
Re: Network slowdown due to CFS, Arjan van de Ven, (Mon Oct 1, 3:35 pm)
RE: Network slowdown due to CFS, David Schwartz, (Mon Oct 1, 3:44 pm)
Re: Network slowdown due to CFS, Arjan van de Ven, (Mon Oct 1, 3:55 pm)
Re: Network slowdown due to CFS, Ingo Molnar, (Mon Oct 1, 11:06 pm)
Re: Network slowdown due to CFS, Ingo Molnar, (Mon Oct 1, 11:08 pm)
Re: Network slowdown due to CFS, Ingo Molnar, (Mon Oct 1, 11:26 pm)
Re: yield API, Ingo Molnar, (Mon Oct 1, 11:46 pm)
Re: Network slowdown due to CFS, Andi Kleen, (Mon Oct 1, 11:47 pm)
Re: Network slowdown due to CFS, Jarek Poplawski, (Tue Oct 2, 2:03 am)
Re: Network slowdown due to CFS, Jarek Poplawski, (Tue Oct 2, 2:26 am)
Re: yield API, linux-os (Dick Johnson), (Tue Oct 2, 4:50 am)
Re: Network slowdown due to CFS, Jarek Poplawski, (Tue Oct 2, 6:39 am)
Re: yield API, Douglas McNaught, (Tue Oct 2, 8:24 am)
RE: Network slowdown due to CFS, David Schwartz, (Tue Oct 2, 8:37 am)
Re: yield API, Eric St-Laurent, (Tue Oct 2, 2:57 pm)
Re: Network slowdown due to CFS, Jarek Poplawski, (Wed Oct 3, 12:15 am)
Re: Network slowdown due to CFS, Jarek Poplawski, (Wed Oct 3, 1:02 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Wed Oct 3, 1:16 am)
Re: Network slowdown due to CFS, Jarek Poplawski, (Wed Oct 3, 1:56 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Wed Oct 3, 2:10 am)
Re: Network slowdown due to CFS, Jarek Poplawski, (Wed Oct 3, 2:50 am)
Re: Network slowdown due to CFS, Dmitry Adamushko, (Wed Oct 3, 3:55 am)
Re: Network slowdown due to CFS, Dmitry Adamushko, (Wed Oct 3, 3:58 am)
Re: Network slowdown due to CFS, Jarek Poplawski, (Wed Oct 3, 4:20 am)
Re: Network slowdown due to CFS, Ingo Molnar, (Wed Oct 3, 4:22 am)
Re: Network slowdown due to CFS, Helge Hafting, (Wed Oct 3, 4:31 am)
Re: Network slowdown due to CFS, Jarek Poplawski, (Wed Oct 3, 4:40 am)
Re: yield, Ingo Molnar, (Wed Oct 3, 4:56 am)
Re: yield, Jarek Poplawski, (Wed Oct 3, 5:16 am)
RE: Network slowdown due to CFS, Rusty Russell, (Wed Oct 3, 5:31 pm)
Re: Network slowdown due to CFS, Casey Dahlin, (Wed Oct 3, 10:33 pm)
Re: Network slowdown due to CFS, Ingo Molnar, (Sun Oct 7, 12:18 am)
Re: yield API, Kyle Moffett, (Wed Dec 12, 9:43 pm)
RE: yield API, David Schwartz, (Thu Dec 13, 1:10 pm)