[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1444099557.2832.48.camel@gmail.com>
Date: Tue, 06 Oct 2015 04:45:57 +0200
From: Mike Galbraith <umgwanakikbuti@...il.com>
To: paul.szabo@...ney.edu.au
Cc: linux-kernel@...r.kernel.org
Subject: Re: CFS scheduler unfairly prefers pinned tasks
On Tue, 2015-10-06 at 08:48 +1100, paul.szabo@...ney.edu.au wrote:
> The Linux CFS scheduler prefers pinned tasks and unfairly
> gives more CPU time to tasks that have set CPU affinity.
> This effect is observed with or without CGROUP controls.
>
> To demonstrate: on an otherwise idle machine, as some user
> run several processes pinned to each CPU, one for each CPU
> (as many as CPUs present in the system) e.g. for a quad-core
> non-HyperThreaded machine:
>
> taskset -c 0 perl -e 'while(1){1}' &
> taskset -c 1 perl -e 'while(1){1}' &
> taskset -c 2 perl -e 'while(1){1}' &
> taskset -c 3 perl -e 'while(1){1}' &
>
> and (as that same or some other user) run some without
> pinning:
>
> perl -e 'while(1){1}' &
> perl -e 'while(1){1}' &
>
> and use e.g. top to observe that the pinned processes get
> more CPU time than "fair".
>
> Fairness is obtained when either:
> - there are as many un-pinned processes as CPUs; or
> - with CGROUP controls and the two kinds of processes run by
> different users, when there is just one un-pinned process; or
> - if the pinning is turned off for these processes (or they
> are started without).
>
> Any insight is welcome!
If they can all migrate, load balancing can move any of them to try to
fix the permanent imbalance, so they'll all bounce about sharing a CPU
with some other hog, and it all kinda sorta works out.
When most are pinned, to make it work out long term you'd have to be
short term unfair, walking the unpinned minority around the box in a
carefully orchestrated dance... and have omniscient powers that assure
that none of the tasks you're trying to equalize is gonna do something
rude like leave, sleep, fork or whatever, and muck up the grand plan.
-Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists