Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp43982yba; Thu, 11 Apr 2019 21:27:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpqWMIVDq4M9Ot01nGQVK7MMfyg/ocz34JCu5TEg8XolPGXzGeBLoMp/BSEy3Wkkf3qnD7 X-Received: by 2002:a62:4602:: with SMTP id t2mr53921888pfa.26.1555043252569; Thu, 11 Apr 2019 21:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555043252; cv=none; d=google.com; s=arc-20160816; b=rHIv2stgNopmxuAow3o0JLCPhHszpoJaFcgaSs/oWHWUF2kMGTuyx7Zfi1z/BcbW2o BZBI7jyGux80wpC+mbOkvNwZflbUtVXkt2RsGNJ1P5G1PrlLM6s4WMOP7DNcp0jzlWtg Jz7O7D0wIjf3YnTnbuoXFqFNvKGdgi3I8Vv3d0/V2k7xtUFUPrkbQAewHJrik+y8CW1b cilAzDhJT0pWuNCXBTyqlWU+P+MNN+zYApDuS+u8OQF2TpsjzO6gapoqhlcavrljevOa r2URH3Hwczh1Qw5rrNABh0j76vffulpDrif2zckCYaO6a1+fEANaovP7GPZBvvubvFba OyQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=U3HPwsqJGqRWQNXWHNMvNFAgdg6011DnVFuiYQhfI1w=; b=Zz4TmAn0W1pGVJ2sC6OqL6MLKVlF7rw71tjHLQ7cukOAwr5v1pwyZAT9ny/yl1fKG3 pBGvkCUHfexpR8ihW9OKLalPfUAVurZgE2JLqa3i2xQmrpl1lPbbElx61mVPFCi6f3Zq E1ZFSuKFRLsGJ6I4mlEalZ+IgE0N0OBihM1MpL2x+GSazqj15NXFUeFdhr+88BLGjQf8 Y4TOPpGnIuVEr7cZZKa83xg+TtM6PPBShzUp2zT9CPvV72DJh1xkCrAMgekR6fwt2/dm Q1QUpFqnJItg/ztomrr/7GpGnrX8n3kDDCIVyycYVdL7o5XXAzc4fAckvrBiVvDxcPr8 2v9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RKzToboE; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i24si35951378pgh.434.2019.04.11.21.27.16; Thu, 11 Apr 2019 21:27:32 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=RKzToboE; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726828AbfDLE02 (ORCPT + 99 others); Fri, 12 Apr 2019 00:26:28 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39845 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725554AbfDLE02 (ORCPT ); Fri, 12 Apr 2019 00:26:28 -0400 Received: by mail-pg1-f195.google.com with SMTP id k3so4547838pga.6 for ; Thu, 11 Apr 2019 21:26:28 -0700 (PDT) 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=U3HPwsqJGqRWQNXWHNMvNFAgdg6011DnVFuiYQhfI1w=; b=RKzToboE++2aPVliLhYrBAQY4d4NXlwLHhkQUUPBZ1eoNm0PW63BfkMOGinzIuJo+O PaoGejbCDTIhQBOrN0GOtNBulNbp8ltmcl8BvGtLAe+63aYvJku35CaG1zo/W+G/eIBo Gr4xMEokkXVkr03oJuRBVXixW2u2JMKQxSXwnITfbLV3+1/Ru3kwTVG4Z8vmoBAolq9q 0kT/qAOq1toMhE1BwA1f+LR+ln+psX30H6UXerxLVS+gIAh6IQDFUt1As2QSyz7txTv+ ghkz4eyoBWaM30nAtlw37uYFvx5m4MnQbWAm73ze/4kDQ6RLSK7yTp+b7/hkB6k4wCOl eeug== 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=U3HPwsqJGqRWQNXWHNMvNFAgdg6011DnVFuiYQhfI1w=; b=WynPGifpJfhG8kIfcQ7ziPO/fcsR21KiE+U6VYP8S4DCClhePKuIiVcSFrBXYLWMUF 7/MfnHc1+eOLgmy9lialoT9fDZe2FrFWJwcyCPiMKOVY66a1ZRiX0j6RDPFOfCjgDqxb K3kW3MCmPijlGvfNylW+r0nveavsXJBdJwMcLSUc1dLdeUCxVfknCVwUpvWBBPlKaCoY bLZiqHrBdvBDf5THtAfGxgsl3T/5KUpVQY+RoHHztQCT3iiAykmm79pWpQHRrz7AkHPj /+/rfoEBY7NvbGP7a8yZTsEM7ySCcD2BoyuptG2HmMO8ivkmNTXwyo241VBPcEJ7XoXI K5Gg== X-Gm-Message-State: APjAAAVjDJK9mQSLW4Xc2MbtuE11RFwY7dVsfAwTADPR4XJlkHBq4Y1C zz8IiSiEzKmbuqB1/df17Q4= X-Received: by 2002:a62:7648:: with SMTP id r69mr34752500pfc.114.1555043187990; Thu, 11 Apr 2019 21:26:27 -0700 (PDT) Received: from bobo.local0.net (115-64-237-195.tpgi.com.au. [115.64.237.195]) by smtp.gmail.com with ESMTPSA id t64sm89997000pfa.86.2019.04.11.21.26.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Apr 2019 21:26:27 -0700 (PDT) From: Nicholas Piggin To: Thomas Gleixner , Frederic Weisbecker Cc: Nicholas Piggin , Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org Subject: [PATCH] kernel/sched: run nohz idle load balancer on HK_FLAG_MISC CPUs Date: Fri, 12 Apr 2019 14:26:13 +1000 Message-Id: <20190412042613.28930-1-npiggin@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The nohz idle balancer runs on the lowest idle CPU. This can interfere with isolated CPUs, so confine it to HK_FLAG_MISC housekeeping CPUs. HK_FLAG_SCHED is not used for this because it is not set anywhere at the moment. This could be folded into HK_FLAG_SCHED once that option is fixed. The problem was observed with increased jitter on an application running on CPU0, caused by nohz idle load balancing being run on CPU1 (an SMT sibling). Signed-off-by: Nicholas Piggin --- kernel/sched/fair.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index fdab7eb6f351..d29ca323214d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9522,22 +9522,26 @@ static inline int on_null_domain(struct rq *rq) * - When one of the busy CPUs notice that there may be an idle rebalancing * needed, they will kick the idle load balancer, which then does idle * load balancing for all the idle CPUs. + * - HK_FLAG_MISC CPUs are used for this task, because HK_FLAG_SCHED not set + * anywhere yet. */ static inline int find_new_ilb(void) { - int ilb = cpumask_first(nohz.idle_cpus_mask); + int ilb; - if (ilb < nr_cpu_ids && idle_cpu(ilb)) - return ilb; + for_each_cpu_and(ilb, nohz.idle_cpus_mask, + housekeeping_cpumask(HK_FLAG_MISC)) { + if (idle_cpu(ilb)) + return ilb; + } return nr_cpu_ids; } /* - * Kick a CPU to do the nohz balancing, if it is time for it. We pick the - * nohz_load_balancer CPU (if there is one) otherwise fallback to any idle - * CPU (if there is one). + * Kick a CPU to do the nohz balancing, if it is time for it. We pick any + * idle CPU in the HK_FLAG_MISC housekeeping set (if there is one). */ static void kick_ilb(unsigned int flags) { -- 2.20.1