Received: by 10.223.176.5 with SMTP id f5csp729749wra; Tue, 30 Jan 2018 18:38:17 -0800 (PST) X-Google-Smtp-Source: AH8x227hYBxi/pWoai6jetyyrHyYWGGA023QpplECuAeUUdRNVxXBdJ4R5Mhlp2KOR07pL0rVbN4 X-Received: by 10.99.135.195 with SMTP id i186mr24885299pge.418.1517366297737; Tue, 30 Jan 2018 18:38:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517366297; cv=none; d=google.com; s=arc-20160816; b=JUpfSxLAnSqFmlhYOvDTQyAah34DbWucJeIxswf95PNidKNacd71xY/TB1edJI6D2p HIwbCfCTyato50VcUiqcujfmHdnZnnI8S1tzXy3BVPD+4JlddKX0O/jOS490F1q7Uly+ Ip2toQ8+unDL0a9pb1U7zXId9zAxaYEzIDj0yvrk9JV/5K04C+BYsWIThomzubbC21Qr wg4YV4NrXi4G8uAnACj8oRPrMBWLM+VlVkuKjXu9yl8yqZKybmM3iBDhX3jzomLOWNpr DdBkdKnaJ4S4z4bTv8czGbiuoiZ/vENBs27ILSSg0qJaz1algAgdg5ZJ8z0OeMbyHZ4p kqLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=CJ5SWa6rkMOGl2dfcRQFn0ioyN2E3m3lSlOKipWVs7s=; b=Ubw4/uW4EEQUBQ8RQ9E5ETjD/vriBYCJdpUe33gnuRz3PQWlMJdABobDLMjJ4KxBoO /p7VqwDo1r4eYoXTZrgk8ES8ygleACFthOkLMruwwcp6wABwL+g2dlPi2viATqXxLNKY S0yS+ZDWDaGd4dG3r8vYE2ZIDyWBwJ3ilg77CoobJnxxzcdPqBxC30kZS0tjpht0sTsz 1wdqROS7avd7EeOIs7i+8QdADEcPW4Ix82Fvkuub+k9e1GwIeHuV97tOqlkM9ZpT36yU XV7Yfbl8jHsQEq5XavFhV81zNo5nRG0IlIZpaRpMC2F1Ju9NkXOdjP0LIUGvOb9E/lCH Vl9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oC97Pwtr; 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 k68si10272736pgc.16.2018.01.30.18.38.03; Tue, 30 Jan 2018 18:38:17 -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=oC97Pwtr; 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 S1751970AbeAaB5z (ORCPT + 99 others); Tue, 30 Jan 2018 20:57:55 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:39371 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751251AbeAaB5y (ORCPT ); Tue, 30 Jan 2018 20:57:54 -0500 Received: by mail-io0-f196.google.com with SMTP id b198so13661595iof.6 for ; Tue, 30 Jan 2018 17:57:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=CJ5SWa6rkMOGl2dfcRQFn0ioyN2E3m3lSlOKipWVs7s=; b=oC97Pwtrc0l6TN0wLwLZtYgCvNEPzcRXG+CfaTeJlqO8agT6jJr7pBLmxAhuoZcrvQ PLJ/OHNMWpwS2vO4dmf4/ej4HbucW9dW13Z7DeeM2LYBOh5125DzDpR6KZC2GwbxSABb 6WO5UBSw1fDHMGqUwzAmqbIAlP5NviqZTUQi/GFpD1wCUob/jF5zjPOtaB+dNA/2KDMt ZuIyrJvCKH8IH8yXeuaK4Ug4kHvrLTZvGfdUVQIPFiY16kMMmQMQa5FYC4KaQTDJa+oX cwf9faH7ebBaYPzjYzgNBXYnbsURpEYndclcASB4Wsx5pfKcahA5EohHVOWxxagk9XFe tQkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=CJ5SWa6rkMOGl2dfcRQFn0ioyN2E3m3lSlOKipWVs7s=; b=frA7CUiWDl7bFUPGQBhyBd2ICGDlBy1kSmzLuA1qjOj/5dytCUaWWeCbmCBma3taMU GOQEg6L/VDT4LQzfJkYvpNKMVf0u8wmfbUlSGwJT+pwFT7pEBkFVGkTvCK/44tWQBgJ7 3lH+SFIrM3QS/UBMESskvsjl3UioYf3BWengEsAI8IqeehQRDvzjm0sfEeMk7UzLFC4W 5Ach0IPguE/mZORYmZWYufvcohdJw2OBW9yDsgteDqrVZUvzzBiVKkah300YYNJBnPIP EKwMccM5/v2Q+m8Ee31xPcZEvst5FPZAEN7oURtZZ/5BHgKtmndU66lV7conQylItquG OaZA== X-Gm-Message-State: AKwxytfizb+iayoHUbHiOzIiao1lV+sjxUeVW5+0R/ZrQuU91rVRmfc3 1OoI6LwKqjfZLyv1kb2jbHKQldwrMoQ9uxEfHPznnA== X-Received: by 10.107.140.88 with SMTP id o85mr31597609iod.219.1517363873049; Tue, 30 Jan 2018 17:57:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.172.135 with HTTP; Tue, 30 Jan 2018 17:57:52 -0800 (PST) In-Reply-To: <6967b972-129a-a7f0-06ab-c48dc9709726@oracle.com> References: <1517268429-933-1-git-send-email-rohit.k.jain@oracle.com> <6967b972-129a-a7f0-06ab-c48dc9709726@oracle.com> From: Joel Fernandes Date: Tue, 30 Jan 2018 17:57:52 -0800 Message-ID: Subject: Re: [RESEND PATCH] sched/fair: consider RT/IRQ pressure in select_idle_sibling To: Rohit Jain Cc: Peter Zijlstra , Ingo Molnar , LKML , steven.sistare@oracle.com, dhaval.giani@oracle.com, Dietmar Eggemann , Vincent Guittot , Morten Rasmussen , "Cc: EAS Dev" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 30, 2018 at 11:47 AM, Rohit Jain wrote: [...] >>> >>> Currently fast path in the scheduler looks for an idle CPU to schedule >>> threads on. Capacity is taken into account in the function >>> 'select_task_rq_fair' when it calls 'wake_cap', however it ignores the >>> instantaneous capacity and looks at the original capacity. Furthermore >>> select_idle_sibling path of the code, ignores the RT/IRQ threads which >>> are also running on the CPUs it is looking to schedule fair threads on. >>> >>> We don't necessarily have to force the code to go to slow path (by >>> modifying wake_cap), instead we could do a better selection of the CPU >>> in the current domain itself (i.e. in the fast path). >>> >>> This patch makes the fast path aware of capacity, resulting in overall >>> performance improvements as shown in the test results. >>> >> [...] >>> >>> I also ran uperf and sysbench MySQL workloads but I see no statistically >>> significant change. >>> >>> Signed-off-by: Rohit Jain >>> --- >>> kernel/sched/fair.c | 38 ++++++++++++++++++++++++++++---------- >>> 1 file changed, 28 insertions(+), 10 deletions(-) >>> >>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >>> index 26a71eb..ce5ccf8 100644 >>> --- a/kernel/sched/fair.c >>> +++ b/kernel/sched/fair.c >>> @@ -5625,6 +5625,11 @@ static unsigned long capacity_orig_of(int cpu) >>> return cpu_rq(cpu)->cpu_capacity_orig; >>> } >>> >>> +static inline bool full_capacity(int cpu) >>> +{ >>> + return capacity_of(cpu) >= (capacity_orig_of(cpu)*3)/4; >>> +} >>> + >>> static unsigned long cpu_avg_load_per_task(int cpu) >>> { >>> struct rq *rq = cpu_rq(cpu); >>> @@ -6081,7 +6086,7 @@ static int select_idle_core(struct task_struct *p, >>> struct sched_domain *sd, int >>> >>> for_each_cpu(cpu, cpu_smt_mask(core)) { >>> cpumask_clear_cpu(cpu, cpus); >>> - if (!idle_cpu(cpu)) >>> + if (!idle_cpu(cpu) || !full_capacity(cpu)) >>> idle = false; >>> } >> >> There's some difference in logic between select_idle_core and >> select_idle_cpu as far as the full_capacity stuff you're adding goes. >> In select_idle_core, if all CPUs are !full_capacity, you're returning >> -1. But in select_idle_cpu you're returning the best idle CPU that's >> the most cap among the !full_capacity ones. Why there is this >> different in logic? Did I miss something? > > > This is the previous discussion on this same code. I measured the > performance difference and saw no statistically significant impact, > hence went with your suggestion of simpler code. Dude :) That is hardly an answer to the question I asked. Hint: *different in logic*. - Joel