From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 847B1C4167D for ; Tue, 12 Apr 2022 08:57:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359000AbiDLI4w (ORCPT ); Tue, 12 Apr 2022 04:56:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359394AbiDLHnA (ORCPT ); Tue, 12 Apr 2022 03:43:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2ED42B24E; Tue, 12 Apr 2022 00:22:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A04F5B81B60; Tue, 12 Apr 2022 07:22:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1F03C385A5; Tue, 12 Apr 2022 07:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649748133; bh=eckn+aBAdWS7OATL4W/IxONHXyEWfphSn5/jhFiGsQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MLVp+ePBQw5qGD4Nx708b3KvaxeDE5i0SrmQh4dUqghiU0fhWngCUK7+VB+sjj+2Y K3RzbwVUQwF96T9Czd9bPAIqekKsspQceJetSVVOYC/mlx59LnsXr9WtdGk2p28HJd PAbJvgDmsMP9BAjZkGiS+W++B0VBufIy3A7WDQw8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Andrzej Siewior , "Peter Zijlstra (Intel)" Subject: [PATCH 5.17 332/343] sched: Teach the forced-newidle balancer about CPU affinity limitation. Date: Tue, 12 Apr 2022 08:32:30 +0200 Message-Id: <20220412063000.901688462@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220412062951.095765152@linuxfoundation.org> References: <20220412062951.095765152@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sebastian Andrzej Siewior commit 386ef214c3c6ab111d05e1790e79475363abaa05 upstream. try_steal_cookie() looks at task_struct::cpus_mask to decide if the task could be moved to `this' CPU. It ignores that the task might be in a migration disabled section while not on the CPU. In this case the task must not be moved otherwise per-CPU assumption are broken. Use is_cpu_allowed(), as suggested by Peter Zijlstra, to decide if the a task can be moved. Fixes: d2dfa17bc7de6 ("sched: Trivial forced-newidle balancer") Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/YjNK9El+3fzGmswf@linutronix.de Signed-off-by: Greg Kroah-Hartman --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5929,7 +5929,7 @@ static bool try_steal_cookie(int this, i if (p == src->core_pick || p == src->curr) goto next; - if (!cpumask_test_cpu(this, &p->cpus_mask)) + if (!is_cpu_allowed(p, this)) goto next; if (p->core_occupation > dst->idle->core_occupation)