Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1645017pxp; Thu, 17 Mar 2022 13:29:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrPVWYyZtQqOjcPOxw6/hGygeRnwa/cb3Otrmti9Fhg8ooJtU4Lax3j2J9L3rFV2Tvzyxy X-Received: by 2002:a17:90b:46d3:b0:1c6:ac97:71d with SMTP id jx19-20020a17090b46d300b001c6ac97071dmr217243pjb.104.1647548949411; Thu, 17 Mar 2022 13:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647548949; cv=none; d=google.com; s=arc-20160816; b=gAGkE6c1q/xrREjKYmCVJIgSigpZo5wBYZ3z1lKNxwolImgsIFWYNznFesB2/7At85 VGudAC839FYn2OnGYBCDJPsYLa4Bko+Ac7IR/RLbOhQtBvYZYhyF0WXWTZIhqK4F9vGk 41mpvpaYpDIOULLxFwCRzu3fWIQDrYOH05WbaMNiy1wSsN4WALCJ3Jt+Knz/cPAO+/vQ qkhcWTr9FDziyANCir11Sb6jYgItt/hOdhAjCOZuvG7SAKmarKe/cfox3+YWaUKrDpgp TC1ifX0udq/DnQO+WbDSotytBBBeBgOwyaHE89OnAn/wBm7tU33w+Wi/Pz4FvIj9odcX D1UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=5HsTkt5LkSywMg+8wsxDE5BciSbvoa8Lt+0obFJ8iQ0=; b=LMEHa9IL+OeDEmGa8eKVAiV7XAitvy20YosjhePiEYWhb7dOw+9Cfw240kr1mtBCSI YC+VsQzoIEwXpqImpT4LaIVTz1ans0WaCYYHEbcYgE/OvlceH6ESH72U9ZD+8wv/8a5M w2tENlIx3xf+eabpyfE3EggeGj8A5xW/sKhga7WBrDG4jmyMxW0qrEdZWhFuWwBBnlg8 5nDWpcKql+XmNdPjOtYtmy91py4BxNqoYJ7B3FoMRBXehkudVJQUp17stNNPwYb9o+Fa rabjnXW9Ov++kNfzQ05NyNxkXl/kp4AWquplO0CYffXuhUh8VG+wxcH6if9w5FhIcoSH uXGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=2k0JxQf9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=DrV1L4Mn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n4-20020a17090aab8400b001bd14e01f95si8691618pjq.131.2022.03.17.13.29.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 13:29:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=2k0JxQf9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=DrV1L4Mn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 622F92C5ED0; Thu, 17 Mar 2022 13:04:34 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234331AbiCQOxX (ORCPT + 99 others); Thu, 17 Mar 2022 10:53:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235447AbiCQOwv (ORCPT ); Thu, 17 Mar 2022 10:52:51 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E4F2202154 for ; Thu, 17 Mar 2022 07:51:35 -0700 (PDT) Date: Thu, 17 Mar 2022 15:51:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1647528693; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5HsTkt5LkSywMg+8wsxDE5BciSbvoa8Lt+0obFJ8iQ0=; b=2k0JxQf9gCasFKRv7xTAJs4apry1MVVEHsIPwzthCr0V7zFHLXjtpHaUkDU8WphQ5PzZYV OlPbhZME5wnEcvWxDHaG7HFGn6vEiKK/STmIkgEKs8Pi22I+p6X4ml+VtboXYUTZx6Xn0q C+1pNmdOHsL2VFpI0r9SV8RS0RXKUnvak7kcfEHfMwUL+g7/R1c06oZnOAQPaYflTavEjP bOwWm0Bxii7GTpN6qhTpFsSLOI0Itiq8sInEE+aiiGdcsM4ixvXDBAMuDI5gRxRRbI9LDS rKofDwS7Vy6LqDIMF4tGtl06euMG3M0iucQFCChPX/VZpO1M13quXlVUDAr+Wg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1647528693; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5HsTkt5LkSywMg+8wsxDE5BciSbvoa8Lt+0obFJ8iQ0=; b=DrV1L4MngTzgpyz/CibEPaIzYAokEGyMlPgKXq0EekDap9Ey9FcBQOV7ohtwY1lE+HFqpY WcMOHdXu6JU7D4Ag== From: Sebastian Andrzej Siewior To: Peter Zijlstra Cc: Steven Rostedt , LKML , Thomas Gleixner , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira Subject: [PATCH] sched: Teach the forced-newidle balancer about CPU affinity limitation. Message-ID: References: <20220308161455.036e9933@gandalf.local.home> <20220315174606.02959816@gandalf.local.home> <20220316203524.GK8939@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index a44414946de3d..421ace2e007de 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5923,7 +5923,7 @@ static bool try_steal_cookie(int this, int that) 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) -- 2.35.1