Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1731526

[RFC PATCH v2] sched/fair: search a task from the tail of the queue

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From "Uladzislau Rezki (Sony)" <urezki@gmail.com>
Newsgroups linux.kernel
Subject [RFC PATCH v2] sched/fair: search a task from the tail of the queue
Date Wed, 13 Sep 2017 12:30:02 +0200
Message-ID <upd5E-677-9@gated-at.bofh.it> (permalink)
X-Original-To Peter Zijlstra <peterz@infradead.org>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=u3u3A6SYwC/mbAmlusKmDQT9uHXJifei+inUKazoUv4=; b=h/Swg8z+uUaKNwavw2vq5NRqKgb4IGyBWR4gKWsuuVPUqS+zF0bNgNfUIZK/GZmvBv j8ZVU6vJw2s5Pmkfx43DJzrFWBaHFUMjPfrQkP2HBUBE4J9EwKWKEYOA9/4sNCrf51Dh uunBWyjub3RQ5NPO+xCe1l1Z/GkkzHUQtoIyi79Xw41KkuRXQNJfwS0QqknwsHzrOWjy 7y/N1MMWvxUXGVELb/cbHq8fcic7v6t3XQKCtYa/mSsa1i1kBm110mE9/SRqRxizjzv1 OpfU6vSc505CrBGUMGhmgTUHID5lDJDPMEguQkUUwx10vEZ5asylV7lmRUGnJv+vOSOV ftrQ==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=u3u3A6SYwC/mbAmlusKmDQT9uHXJifei+inUKazoUv4=; b=Cn0Y7X/CJ6hBATGs3h/XxvgkLPbzmJgmFcpeHPjMZyFrrJ0ON43BBI3gRyHkVYNfRJ l9SYlxVq5a7GpXIQTabDoduV85rVdMUG1PU/95GEhQL3ZE8UHyBdkINeTgGrETuQFiaZ G2qWNuiYFsNLbAOcm1pKJ7HEK686rEh+wwb6/gEJiDzoMVzZkU9ko20QqrPmxNFl7Z9h B/nQRS83oB3+hadr8gfcIQK5dpj7tYad0GsUPBtLeSCcvogvukfMlS7k+oQ9EG+uXbEg axNxgx8UYN5nlBjwb9pItZsi5ez82iu8wZyaBSBwyzvzPB/mOvBb1F0VYBprzXkWCVuL RU6w==
X-Gm-Message-State AHPjjUgoI8PNS3+nXTz3eOgNb9lDVdBQlGpYW+5jK/1IadC3d+8eec4p Jl77iKSISUPYvA==
X-Google-SMTP-Source AOwi7QBT1H+p/UMEUevoOPK/baRt49aBS/3qjnRKhFP7AiQVaxPl6GVHFEzbTtzSADfUDs2R3jItuw==
X-Received by 10.46.41.203 with SMTP id p72mr2310422ljp.5.1505298284493; Wed, 13 Sep 2017 03:24:44 -0700 (PDT)
X-Mailer git-send-email 2.11.0
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 86
Organization linux.* mail to news gateway
X-Original-Cc LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@redhat.com>, Mike Galbraith <efault@gmx.de>, Oleksiy Avramchenko <oleksiy.avramchenko@sonymobile.com>, Paul Turner <pjt@google.com>, Oleg Nesterov <oleg@redhat.com>, Steven Rostedt <rostedt@goodmis.org>, Mike Galbraith <umgwanakikbuti@gmail.com>, Kirill Tkhai <tkhai@yandex.ru>, Tim Chen <tim.c.chen@linux.intel.com>, Nicolas Pitre <nicolas.pitre@linaro.org>, "Uladzislau Rezki (Sony)" <urezki@gmail.com>
X-Original-Date Wed, 13 Sep 2017 12:24:29 +0200
X-Original-Message-ID <20170913102430.8985-1-urezki@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1731526

Show key headers only | View raw


Objective:

In an attempt to improve the criteria of which tasks we should consider to
be migrated (SMP case) during load balance operations, i have done some
performance evaluations.

Test environment:

- set performance governor
- echo 0 > /proc/sys/kernel/nmi_watchdog
- intel_pstate=disable
- i5-3320M CPU @ 2.60GHz

Test results:

A first test was to evaluate hackbench with different number of groups,
i used 10, 20, 40. See below plots with results:

i=0; while [ $i -le 1000 ]; do ./hackbench 10 | grep "Time" | awk '{print $2}'; i=$(($i+1)); done
ftp://vps418301.ovh.net/incoming/hacknench_1000_samples_10_groups.png

i=0; while [ $i -le 1000 ]; do ./hackbench 20 | grep "Time" | awk '{print $2}'; i=$(($i+1)); done
ftp://vps418301.ovh.net/incoming/hacknench_1000_samples_20_groups.png

i=0; while [ $i -le 1000 ]; do ./hackbench 40 | grep "Time" | awk '{print $2}'; i=$(($i+1)); done
ftp://vps418301.ovh.net/incoming/hacknench_1000_samples_40_groups.png

A second test was to evaluate how "perf bench sched pipe" behaves in a single
CPU scenario. As Peter Zijlstra suggested before, to check caches and find out
extra overhead caused by list manipulation:

i=0; while [ $i -le 500 ]; do taskset 1 perf bench sched pipe | grep "Total" | awk '{print $3}'; i=$(($i+1)); done
ftp://vps418301.ovh.net/incoming/taskset_1_perf_bench_sched_pipe.png

Added overhead:

First, i checked if "cfs_tasks" and "group_node" are in a cache line
by annotating pick_next_task_fair symbol and running single CPU test.

perf record -F 100000 -a -e L1-dcache-misses -- taskset 1 perf bench sched pipe -l 10000000
perf annotate pick_next_task_fair

Most of the time i see that cfs_tasks and group_node are in L1-dcache line:

       │             __list_del(entry->prev, entry->next);
  3.51 │       mov    0xb0(%rbp),%rdx
  1.75 │       mov    0xa8(%rbp),%rcx
       │     pick_next_task_fair():
       │                     list_move(&p->se.group_node, &rq->cfs_tasks);
       │       lea    0xa8(%rbp),%rax
       │     __list_del():

group_node: 3.51 corresponds to 2 samples or misses. Minimum value is 0
maximum is 2 misses, among 10 runs.

       │     list_add():
       │             __list_add(new, head, head->next);
  2.44 │       mov    0x940(%r15),%rdx
       │     __list_add():

cfs_tasks: 2.44 corresponds to 1 sample or misses. Minimum value is 0
maximum is 2 misses, among 10 runs.

In case of checking all level cache misses "-e cache-misses" i do not
see any samples or misses.

Conclusion:

according to provided results and my subjective opinion, it worth to
sort cfs_task list and start pulling from the back of the list during
load balance (+ active) or idle balance operations.

It would be appreciated if there are any comments, proposals or ideas
regarding this small investigation.

Best Regards,
Uladzislau Rezki

Uladzislau Rezki (1):
  sched/fair: search a task from the tail of the queue

 kernel/sched/fair.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

-- 
2.11.0

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[RFC PATCH v2] sched/fair: search a task from the tail of the queue "Uladzislau Rezki (Sony)" <urezki@gmail.com> - 2017-09-13 12:30 +0200

csiph-web