From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751306AbbJEVx5 (ORCPT ); Mon, 5 Oct 2015 17:53:57 -0400 Received: from talus.maths.usyd.edu.au ([129.78.68.1]:32997 "EHLO talus.maths.usyd.edu.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750780AbbJEVxz (ORCPT ); Mon, 5 Oct 2015 17:53:55 -0400 X-Greylist: delayed 325 seconds by postgrey-1.27 at vger.kernel.org; Mon, 05 Oct 2015 17:53:55 EDT X-smtpdoor-from: psz@maths.usyd.edu.au X-smtpdoor-want-Message-ID: <201510052148.t95LmQm6018585@como.maths.usyd.edu.au> Date: Tue, 6 Oct 2015 08:48:26 +1100 From: paul.szabo@sydney.edu.au Message-Id: <201510052148.t95LmQm6018585@como.maths.usyd.edu.au> To: linux-kernel@vger.kernel.org Subject: CFS scheduler unfairly prefers pinned tasks Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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! --- I would appreciate replies direct to me as I am not subscribed to the linux-kernel mailing list (but will try to watch the archives). This bug is also reported to Debian, please see http://bugs.debian.org/800945 I use Debian with the 3.16 kernel, have not yet tried 4.* kernels. Thanks, Paul Paul Szabo psz@maths.usyd.edu.au http://www.maths.usyd.edu.au/u/psz/ School of Mathematics and Statistics University of Sydney Australia