Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1149328rdd; Wed, 10 Jan 2024 10:02:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IH0xdYpXEw5eW2ZX8fR35pnIUoA7CaWs8o8EXR47XF2VblDtkQq6uBtAz9SuLh4lT1+xWWF X-Received: by 2002:a05:6a00:a88:b0:6d9:a651:4b07 with SMTP id b8-20020a056a000a8800b006d9a6514b07mr3976pfl.46.1704909749407; Wed, 10 Jan 2024 10:02:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704909749; cv=none; d=google.com; s=arc-20160816; b=tc8/456uUBsaf/DzyLYZdw2Mjuv+1k6YjT/zyyVKi3Vfi5TKaBewyrPT8l3DlfJg8q 8WsNui1qJV5U1jdgFdwfo88x04W/OnK3RlGNs19L0WauurtiHPrjI2dP3uebGKAkZf2y KxxcpTGBEI6fd+BNrGCyik8Gwr/YFd//P8AbiEB51CVIdUBhFxEInPKWsQnPGwwlvqg2 h6+0JAkoZxGMglstXhkG2BPU8fO6UrNyuBaVUAsMFdnD95ZWycIOD/k+FPd/zSAGEoRI VOFFkjOeVU+i6tW3Yu23on6O+cv9Fqft0+YfOYtD7tXqj9tLdptCrZVg1MnYM3GDnN92 XEDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Tlm8HNK9gWUhS12CM9y1YxeQQner0p1cxWc16J5vCuM=; fh=3kvEh0auDiKMJts/ddMiseqCLZzZbPwmGMhqPsVydmU=; b=XH+fNTH9f7j+vELeA/Hl4UpECRQ++4g3yCLZ87+TddFDi5zyViJjOaQG7dB5PWIwEN hwjEvR55C7EXQVl1mvWzKrQZVMdP2MSENBnGTLUXxnoEwg9ybaGdEqbYtGhf3nt9dhB7 3jE+JuXEXFj4JtnJCq90oG4BNJ2xV4/1H01tmuugF4Cu3IWA6NoOnqXODl+zeAiukjhI 8CSTgP5ftMFC2YG7BbRk9m5LRoUxiy0pK+gZFh6gLjzZGt0vwTRudDSwvnhkNECcihvW 1WwVPsEiyZA67FkQ6Qebjz8eriOhAyr28TfEWVN7wSF5phZfBGFNTh0qKApcR0yBFA0j JvMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=jQnQ7Blj; spf=pass (google.com: domain of linux-kernel+bounces-22579-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22579-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id lb15-20020a056a004f0f00b006d9a42d1cdcsi4121080pfb.11.2024.01.10.10.02.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 10:02:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22579-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=jQnQ7Blj; spf=pass (google.com: domain of linux-kernel+bounces-22579-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22579-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3F14BB278A3 for ; Wed, 10 Jan 2024 17:57:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3DBAB4D121; Wed, 10 Jan 2024 17:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b="jQnQ7Blj" Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85A954D109 for ; Wed, 10 Jan 2024 17:57:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=Tlm8HNK9gWUhS12CM9y1YxeQQner0p1cxWc16J5vCuM=; b=jQnQ7BljNKzFV9iwU0QVMeF3NaHzYfpXf2ajwnqb91fPu0iflqGeBTGS XdoXbzf2R3YS726GJ75Y6dveIww0jYpPdlEFOTDTyvHu1T80GfKstpwfm +YbKdvfKH28Rro1iyd6li9g++r+s9L2Y8W0O7yUEdc5MHVKVRdV3kR2LT w=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=keisuke.nishimura@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.04,184,1695679200"; d="scan'208";a="145952116" Received: from dt-aponte.paris.inria.fr (HELO [128.93.67.66]) ([128.93.67.66]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2024 18:57:25 +0100 Message-ID: <8d9e076c-8505-4538-83f5-506ccf62f7a9@inria.fr> Date: Wed, 10 Jan 2024 18:57:24 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/2 RESEND] sched/fair: take into account scheduling domain in select_idle_smt() Content-Language: en-US To: Vincent Guittot Cc: Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, Dietmar Eggemann , Mel Gorman , Valentin Schneider , Julia Lawall , Xunlei Pang , Abel Wu References: <20240110131707.437301-1-keisuke.nishimura@inria.fr> From: Keisuke Nishimura In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit >> >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >> index 533547e3c90a..66457d4b8965 100644 >> --- a/kernel/sched/fair.c >> +++ b/kernel/sched/fair.c >> @@ -7311,13 +7311,19 @@ static int select_idle_core(struct task_struct *p, int core, struct cpumask *cpu >> /* >> * Scan the local SMT mask for idle CPUs. >> */ >> -static int select_idle_smt(struct task_struct *p, int target) >> +static int select_idle_smt(struct task_struct *p, struct sched_domain *sd, int target) >> { >> int cpu; >> >> for_each_cpu_and(cpu, cpu_smt_mask(target), p->cpus_ptr) { >> if (cpu == target) >> continue; >> + /* >> + * Check if the CPU is in the LLC scheduling domain of @target. >> + * Due to isolcpus, there is no guarantee that all the siblings are in the domain. >> + */ >> + if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) > > commit df3cb4ea1fb6 ("sched/fair: Fix wrong cpu selecting from isolated domain") > also checked if (!cpumask_test_cpu(cpu, p->cpus_ptr) || > > Why didn't you also re-add this test ? > > Thank you for your comment. This is because the iterator "for_each_cpu_and(cpu, cpu_smt_mask(target), p->cpus_ptr)" ensures that cpu is included in p->cpus_ptr. The iterator has changed. FYI, here is the change made in commit df3cb4ea1fb6: for_each_cpu(cpu, cpu_smt_mask(target)) { - if (!cpumask_test_cpu(cpu, p->cpus_ptr)) + if (!cpumask_test_cpu(cpu, p->cpus_ptr) || + !cpumask_test_cpu(cpu, sched_domain_span(sd))) continue; if (available_idle_cpu(cpu) || sched_idle_cpu(cpu)) best, Keisuke