Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp238363ybi; Wed, 29 May 2019 20:24:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzW0juX9qVbp5tzVlzejXhnmWy05CiknGy8XxmFmeF4yV7UFf74Fm8CDR6tzdUNC38lTIZU X-Received: by 2002:a63:c94f:: with SMTP id y15mr1634538pgg.159.1559186660156; Wed, 29 May 2019 20:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559186660; cv=none; d=google.com; s=arc-20160816; b=W25p//CZKFWrS3BzlU7TWsTrT4i7vexT3S/dwDWIoIxTV/VjyX0L67V6fKxQgDkeNb gybAC7p9PPEiltkFS/Y/lnvkOZ2AEUgQGeKRLyZ4KP3R+nSO9GsAN2eQ6DQRFJ4ucdJj A15oY1Ag2vLj5xTKOPdNSjHMsPfP0XA2ZA38IUC4IxVECHk9XglhCg2u3AG6HvrKdCa9 lukMq4sh2vNdZ3d34Id1Z0INLVdIAmoAKMjfKpipPEJeVR5CnDndqB3NC7HmHcaEJf5g OKzaxEsMRXTDw6n4qxVI6L9l9M4olq6MyUpxEkmPzFpgI76dJpu+lq4zm9bvK+O/rXxy Vx6w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g2hyk189oPocN9kt5fc1LJCGswTX0l3eRuDyVsvQEXc=; b=s+VoHL/9ZAJSNkkeLgIuOMYNnr9u24L6dYdHMVnNVS8dJ/Vh9kTlgcpv76GpPPCMT2 fMKhQv3szc3vcdmudVZ4lGwd/2G0NC5LMi8T28XwiNZ3rfxRdzVc9filb70Kta24E3On JcYKKs5srodDkmN6te8ncfnKdvWYYaG32qfMCxVwBjzg2H1wM39HvYgRoI3IFlrC3wHW 1WZ7InpJE+/1X6zxn4zZEtAP637XrcQ8n0mSCgoK3s0c2ShAh6MSOG+6JNbbm3ygWOJF yLrMPjOTjPs32/pcoH18VmEFqC78Zs4JBsdaNQn80rIzllOxChomFFwby2E1vZU3lbfp ZbwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LNCeYOX5; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s145si2327347pfc.283.2019.05.29.20.24.04; Wed, 29 May 2019 20:24:20 -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=@kernel.org header.s=default header.b=LNCeYOX5; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732750AbfE3DWU (ORCPT + 99 others); Wed, 29 May 2019 23:22:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:43698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730779AbfE3DQn (ORCPT ); Wed, 29 May 2019 23:16:43 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 366AA24624; Thu, 30 May 2019 03:16:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186203; bh=PXyNiBVDngqp8kmfxOJ/7Q+LgxW2Mff6MtqJg3Du+ZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LNCeYOX5UZfail6Wbsl0gw3dslm7PInh2+xnLckNoujoQ7OwaZiIu3Dgk1Nd8pqM1 mjRKfWH9OMk0CNyqX8keHYAhGZwzyDtM0TLmEHGaGpcYVhIlN/h4C0LPgGRmEJeLPO Z1TMCpjynESecksrCXwcxCqUUqaktN+h6xyDBy+k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , "Peter Zijlstra (Intel)" , Frederic Weisbecker , Linus Torvalds , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH 4.19 088/276] sched/nohz: Run NOHZ idle load balancer on HK_FLAG_MISC CPUs Date: Wed, 29 May 2019 20:04:06 -0700 Message-Id: <20190530030531.755189018@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 9b019acb72e4b5741d88e8936d6f200ed44b66b2 ] 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 Signed-off-by: Peter Zijlstra (Intel) Cc: Frederic Weisbecker Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: https://lkml.kernel.org/r/20190412042613.28930-1-npiggin@gmail.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin --- 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 d31916366d39c..7a1e9db617f76 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9083,22 +9083,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