Received: by 10.223.164.202 with SMTP id h10csp579587wrb; Thu, 9 Nov 2017 10:53:53 -0800 (PST) X-Google-Smtp-Source: ABhQp+T8YclixGrro391s7mZC66UBnZv8PplVO81oVHb0/KkldewqkFQakEczfJ0USzAPBK8sHX8 X-Received: by 10.98.202.131 with SMTP id y3mr1422093pfk.199.1510253633445; Thu, 09 Nov 2017 10:53:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510253633; cv=none; d=google.com; s=arc-20160816; b=Q0zR0Dlp6sogaMY9vjsB2dDruBuKChso0Jd7QnGCawVPt2C34mMRbMMLiZKSHHm+f8 WV/4WdhxSbPPiGRCinVeNUkP4M94+InH3gKf4kIDpTq3xgC5bto8Kqa6VHSAcDSTlDoz OQItAVEEt7bcr6jCDMxQ6i/HG6hJm9+wFZZWbxStF3npna6bE+jY9P6rsC6QMIo13iKF Mk9w75gg+C0xDTdeRsxx9iQ0N1ZxXTHmyca93yY0Jmbpxhou+1QnMUwP4TzSD4PVked5 ptnEVM635TxVJ52H/0ZZDtEU3f1vGGVBZzcvbnhift2hnJgfKftfxvABY9piCsDf7Ns1 CfSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=AzJD3aA8JhYtkYSZlL9IIj5t8RBHDNS0u3SBwNzRDW4=; b=Z9woLiuRL/MyfteKWkqqhkVWfPAqR4+rLWixu8oGaGKmdUut1q7aThYefTOzQncZSC dyoh5kW08fYJ2R/jIxngx3zeLmp9Cc6hEOf25sCK4eh7nqpgcNnfhkTY5KbbEY/2kUZZ xHh4eiRW1miHaysPr7LNZxqnnyqZdV3ZtM8sp7a0fU6QJkSqpehmManGSshw4gL1jgAP 07yFn06FCidMcLrGA+MIVczfaCyWIqngTIWKniBTViO2XrFQjF6xOCtMRDsxYcGS0fxd aRiaZudRCvL+ClYiC+O7YPOpxWjrT0ljlKT+XXhkZPv4Gh7M9u0pQfdp2jPgF2uZW15y SMwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Hu/r8RLL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x5si6746022plo.143.2017.11.09.10.53.41; Thu, 09 Nov 2017 10:53:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Hu/r8RLL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754030AbdKISw6 (ORCPT + 82 others); Thu, 9 Nov 2017 13:52:58 -0500 Received: from mail-qt0-f193.google.com ([209.85.216.193]:49555 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752867AbdKISw5 (ORCPT ); Thu, 9 Nov 2017 13:52:57 -0500 Received: by mail-qt0-f193.google.com with SMTP id y45so2796634qty.6 for ; Thu, 09 Nov 2017 10:52:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=AzJD3aA8JhYtkYSZlL9IIj5t8RBHDNS0u3SBwNzRDW4=; b=Hu/r8RLLmlNDnlOHXXb7wwPYfrk1w9ipujWrDWNjk2L+fiUBrDka1wxK1Re4ZBBMeO uPhRQedU6SBICfmmzhWE3UnA6KXUc6srZ4OaqbEz7mPIxK6uIR1wgK6Fmzuhv4B/eSYm rFN3dcZBdy2bcS1orxnMDUI7xG847zB5yqLqPVz+azz+aXkUOAeSY9xrpnSHG/DZqIJb UmHQsCy3B2z7JDorKuehqMeFN4fr0tQBgzfmjx1/XqQrn5z5YwSluqk9kZd7gjAlFTrI XIJl3yeUoENqsKSmUh4Z2ZCIs9Pn80jZjsaAavNgqHtf8jw9AtNwiRe3b+1ptbXH+Xhg VLVQ== 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; bh=AzJD3aA8JhYtkYSZlL9IIj5t8RBHDNS0u3SBwNzRDW4=; b=E20VZ+Z5Wmtt/lu75NsWZEtDZX1ESkgqT+2JggpQBpemrxlAYAfNFcpUtX1UZXIrhW aL5oOFDxDANr+nzp+gmNUeFSo4c3+1m93xOMFdnAo7CvCMCQlZYByDAfmADzV4mFhkwo AMA1wha/r+oMneTU4CEsEc//rAxXGS3U0OCETJGCFDnMZiF/8sxSgKekhynn0qkFUKeq Zq2cWxES8cDcPD3gWNgy4pnE9yNDp2oRKNIBSiGzL9I/X/7Z5y7rsQ+OwImtP18V++HP 7Oeb+Z48yUW1+WChT0dYK7VB3UKvC5mrGQ7CjNVFHR+aooQwsE/nGxjslTutRA+7fyNm R6iQ== X-Gm-Message-State: AJaThX4IbTOHHds5R4fUMpxVJOEU5FfZ4C25b7DMRideHoPgDuy0uhmU PhLOtbPHLVgfdE67okjX4VungH4bWwY= X-Received: by 10.237.60.249 with SMTP id e54mr2476494qtf.23.1510253575852; Thu, 09 Nov 2017 10:52:55 -0800 (PST) Received: from joelaf-glaptop0.hsd1.va.comcast.net (c-76-123-2-128.hsd1.va.comcast.net. [76.123.2.128]) by smtp.gmail.com with ESMTPSA id l126sm4949699qkf.96.2017.11.09.10.52.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Nov 2017 10:52:54 -0800 (PST) From: Joel Fernandes To: linux-kernel@vger.kernel.org Cc: Joel Fernandes , Dietmar Eggemann , Vincent Guittot , Morten Ramussen , Brendan Jackman , Srinivas Pandruvada , Len Brown , "Rafael J. Wysocki" , Viresh Kumar , Ingo Molnar , Peter Zijlstra , Juri Lelli , Patrick Bellasi , Chris Redpath , Steve Muckle , Steven Rostedt , Saravana Kannan , Vikram Mulukutla , Rohit Jain , Atish Patra , EAS Dev , Android Kernel Subject: [PATCH] sched/fair: Consider RT/IRQ pressure in capacity_spare_wake Date: Thu, 9 Nov 2017 10:52:19 -0800 Message-Id: <20171109185219.30130-1-joelaf@google.com> X-Mailer: git-send-email 2.15.0.448.gf294e3d99a-goog Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org capacity_spare_wake in the slow path influences choice of idlest groups, as we search for groups with maximum spare capacity. In scenarios where RT pressure is high, a sub optimal group can be chosen and hurt performance of the task being woken up. Several tests with results are included below to show improvements with this change. 1) Hackbench on Pixel 2 Android device (4x4 ARM64 Octa core) ------------------------------------------------------------ Here we have RT activity running on big CPU cluster induced with rt-app, and running hackbench in parallel. The RT tasks are bound to 4 CPUs on the big cluster (cpu 4,5,6,7) and have 100ms periodicity with runtime=20ms sleep=80ms. Hackbench shows big benefit (30%) improvement when number of tasks is 8 and 32: Note: data is completion time in seconds (lower is better). Number of loops for 8 and 16 tasks is 50000, and for 32 tasks its 20000. +--------+-----+-------+-------------------+---------------------------+ | groups | fds | tasks | Without Patch | With Patch | +--------+-----+-------+---------+---------+-----------------+---------+ | | | | Mean | Stdev | Mean | Stdev | | | | +-------------------+-----------------+---------+ | 1 | 8 | 8 | 1.0534 | 0.13722 | 0.7293 (+30.7%) | 0.02653 | | 2 | 8 | 16 | 1.6219 | 0.16631 | 1.6391 (-1%) | 0.24001 | | 4 | 8 | 32 | 1.2538 | 0.13086 | 1.1080 (+11.6%) | 0.16201 | +--------+-----+-------+---------+---------+-----------------+---------+ 2) Rohit ran barrier.c test (details below) with following improvements: ------------------------------------------------------------------------ This was Rohit's original use case for a patch he posted at [1] however from his recent tests he showed my patch can replace his slow path changes [1] and there's no need to selectively scan/skip CPUs in find_idlest_group_cpu in the slow path to get the improvement he sees. barrier.c (open_mp code) as a micro-benchmark. It does a number of iterations and barrier sync at the end of each for loop. Here barrier,c is running in along with ping on CPU 0 and 1 as: 'ping -l 10000 -q -s 10 -f hostX' barrier.c can be found at: http://www.spinics.net/lists/kernel/msg2506955.html Following are the results for the iterations per second with this micro-benchmark (higher is better), on a 44 core, 2 socket 88 Threads Intel x86 machine: +--------+------------------+---------------------------+ |Threads | Without patch | With patch | | | | | +--------+--------+---------+-----------------+---------+ | | Mean | Std Dev | Mean | Std Dev | +--------+--------+---------+-----------------+---------+ |1 | 539.36 | 60.16 | 572.54 (+6.15%) | 40.95 | |2 | 481.01 | 19.32 | 530.64 (+10.32%)| 56.16 | |4 | 474.78 | 22.28 | 479.46 (+0.99%) | 18.89 | |8 | 450.06 | 24.91 | 447.82 (-0.50%) | 12.36 | |16 | 436.99 | 22.57 | 441.88 (+1.12%) | 7.39 | |32 | 388.28 | 55.59 | 429.4 (+10.59%)| 31.14 | |64 | 314.62 | 6.33 | 311.81 (-0.89%) | 11.99 | +--------+--------+---------+-----------------+---------+ 3) ping+hackbench test on bare-metal sever (Rohit ran this test) ---------------------------------------------------------------- Here hackbench is running in threaded mode along with, running ping on CPU 0 and 1 as: 'ping -l 10000 -q -s 10 -f hostX' This test is running on 2 socket, 20 core and 40 threads Intel x86 machine: Number of loops is 10000 and runtime is in seconds (Lower is better). +--------------+-----------------+--------------------------+ |Task Groups | Without patch | With patch | | +-------+---------+----------------+---------+ |(Groups of 40)| Mean | Std Dev | Mean | Std Dev | +--------------+-------+---------+----------------+---------+ |1 | 0.851 | 0.007 | 0.828 (+2.77%)| 0.032 | |2 | 1.083 | 0.203 | 1.087 (-0.37%)| 0.246 | |4 | 1.601 | 0.051 | 1.611 (-0.62%)| 0.055 | |8 | 2.837 | 0.060 | 2.827 (+0.35%)| 0.031 | |16 | 5.139 | 0.133 | 5.107 (+0.63%)| 0.085 | |25 | 7.569 | 0.142 | 7.503 (+0.88%)| 0.143 | +--------------+-------+---------+----------------+---------+ [1] https://patchwork.kernel.org/patch/9991635/ Matt Fleming also ran cyclictest and several different hackbench tests on his test machines to santiy-check that the patch doesn't harm any of his usecases. Cc: Dietmar Eggemann Cc: Vincent Guittot Cc: Morten Ramussen Cc: Brendan Jackman Tested-by: Rohit Jain Tested-by: Matt Fleming Signed-off-by: Joel Fernandes --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 56f343b8e749..ba9609407cb9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5724,7 +5724,7 @@ static int cpu_util_wake(int cpu, struct task_struct *p); static unsigned long capacity_spare_wake(int cpu, struct task_struct *p) { - return capacity_orig_of(cpu) - cpu_util_wake(cpu, p); + return max_t(long, capacity_of(cpu) - cpu_util_wake(cpu, p), 0); } /* -- 2.15.0.448.gf294e3d99a-goog From 1585560950801407647@xxx Fri Dec 01 06:12:35 +0000 2017 X-GM-THRID: 1585560950801407647 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread