lkml.org 
[lkml]   [2015]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: CFS scheduler unfairly prefers pinned tasks
    From
    Date
    On 10/10/15 11:59 AM, Wanpeng Li wrote:
    > Hi Paul,
    > On 10/8/15 4:19 PM, Mike Galbraith wrote:
    >> On Tue, 2015-10-06 at 04:45 +0200, Mike Galbraith wrote:
    >>> On Tue, 2015-10-06 at 08:48 +1100, paul.szabo@sydney.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".
    >
    > Interesting, I can reproduce it w/ your simple script. However, they
    > are fair when the number of pinned perl tasks is equal to unpinned
    > perl tasks. I will dig into it more deeply.

    For the pinned tasks, when set the task affinity to all the available
    cpus instead of the separate cpu as in your test, there is fair between
    pinned tasks and unpinned tasks. So I suspect that if it is the overhead
    associated with migration stuff.

    Regards,
    Wanpeng Li



    \
     
     \ /
      Last update: 2015-10-10 10:21    [W:3.243 / U:0.096 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site