Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1506104rdd; Thu, 11 Jan 2024 00:53:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IHA76V0xgINfH2MhNMpbJ3ZZh62LXd+nkPBOEWwFqi2CWBh7s4k/ASgidUwtjGcIr9aSkbc X-Received: by 2002:a05:6402:94a:b0:557:e00f:a499 with SMTP id h10-20020a056402094a00b00557e00fa499mr339819edz.78.1704963199217; Thu, 11 Jan 2024 00:53:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704963199; cv=none; d=google.com; s=arc-20160816; b=Hovj2bwYIdKKFt5mkSF44HIei0LWleiTOioPX9b3UMWwB9PmbU/m7jVL5YNm3JRo5L WbsqNLMYFmQ/O+QmMQl2ZjWjXYhuRcdL/ON5+AgRv6G57mHgXBqSW/wh77V0QwwDisZG Brjxc+bpbjRPAhD4dBE/UEkPU8XTuQqkzam2y81hla/MXdgeUipP0BUteAD6zF2qATPg KNMwI7VTdc7tDUys0fO5edsyf9tp9uWHPLe7AsivV5PW2i8Ok7MlDquTJ/a1hHy//0Ix QViirS/dAAIrEULhSzMUbjVMd8anjqJQCF+XzL2DZagjZNg0gmLv006biZ+RH6KUaA2D y18Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=T4e6Zeh9ktpPN489K8Bx9njOW7cObEYYxVQYUCbqBhE=; fh=e8w6zdqlnJmoDv/WTJfZZBq5DUOt9zZO9Nt/J1ZEXMU=; b=J4NAF2vpfaIZwe1qh+S+RcGBnTvjiDADYOUO9bCTG9RwAtkFPrrpnjNSgtGPzaMgrM W/9b/rbp+S+/s0qFxkCC96hWHXCXWgAZ6a12hTMFZeMHylyB48jhsH7kezJ9Q60F1feP zmLfKqRpbFxOV43a1Jyl46LjMuovzqsgqPW8IaTWnjIxqZWFAX9m7EQ7g1rdkxGdUWzE XGw4jh+69OX22MwKgx+cdUMsxRzYQuM3RTaSVYcA0OcCPUL1ent5GvTK7blOoMZBwmnZ RLDch++ye0k+849VaIrarQrkvAH8iNmdMOUOakRty2w5lh4n36qletiF0PZBD3Fa1ER4 qWcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UlWN2TBl; spf=pass (google.com: domain of linux-kernel+bounces-23247-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23247-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b21-20020a0564021f1500b005546ff2dcf3si329305edb.141.2024.01.11.00.53.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 00:53:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23247-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UlWN2TBl; spf=pass (google.com: domain of linux-kernel+bounces-23247-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23247-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id EC8821F2431C for ; Thu, 11 Jan 2024 08:53:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7FFE611733; Thu, 11 Jan 2024 08:53:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UlWN2TBl" Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 400ED11704 for ; Thu, 11 Jan 2024 08:53:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-5cdbc7bebecso2146147a12.1 for ; Thu, 11 Jan 2024 00:53:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704963189; x=1705567989; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=T4e6Zeh9ktpPN489K8Bx9njOW7cObEYYxVQYUCbqBhE=; b=UlWN2TBlYF4d6zyMvO4hTEyteoNG2wPzPwxe4FU62cbJrfEVkq8WRdlDcwg87kFlVw CTvV16FqRED2J0k2QcZCz3WuIDaWDMlqY+w+ayStHrsuyNi84WxkMiAulRFAqM6yASL/ HZD6W01UfllulFBu93a2clwf32OMzKosvZaaI5L8XU8dx1wwS/6ZNugSvOp7wWDWfVF4 L2fd1LgFQBBBkXlhxu9rfPa4l01oNfg+TKfJ9pKKcun3LHapKPZkL1DtybC1UfYwm2NW eHQXecYinzMtoMGn8DljGP+d62BisAIsOBfOxjZV3tA8Nb4kB8S11MZXgKOBFc296gUz J0rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704963189; x=1705567989; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=T4e6Zeh9ktpPN489K8Bx9njOW7cObEYYxVQYUCbqBhE=; b=Pb6RovUGiBL/1MG1qlpxy2FDjDGjwE4YmD8fLqZkUM/H7HLHh9HOxepy7c65vhz4Fb TmY+oXb0tFXtDRPYBP0WvM5Dryq+Ptiw5/VfRRibh1KB7MBtHR11EwIoQwz0xyQIr0zZ 8q3RXg7BHGpoJI2sI9ND6bTirC6e2NP4OzsDv+5jwLWeH9SIqgk2fRGflnibgIw1bRDk eP73NJBTvBaOuxNzeUxV0S0P6Qh+gowCPUg5272qlYlTRfprkkkL3ApyBv5A2knKjIwg UAZFUgAD1QwYcjEWDnK3IwuO53bQRiF0wbBzZZRpmt5XjO8u2eBaxM6nHD3hw/ipWGDf y5Uw== X-Gm-Message-State: AOJu0YwP+P2XR3rW632gdDb19tKqLYRktYJ9otexRzc1X+P5qGn9qUON GDQO5ukNYZsCS1p5AzP7nVB3gdOtCZoDiLU7Ou1gVLThjunj1Q== X-Received: by 2002:a17:90a:cb90:b0:28b:c953:77b0 with SMTP id a16-20020a17090acb9000b0028bc95377b0mr505334pju.97.1704963189425; Thu, 11 Jan 2024 00:53:09 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240110131707.437301-1-keisuke.nishimura@inria.fr> <8d9e076c-8505-4538-83f5-506ccf62f7a9@inria.fr> In-Reply-To: <8d9e076c-8505-4538-83f5-506ccf62f7a9@inria.fr> From: Vincent Guittot Date: Thu, 11 Jan 2024 09:52:53 +0100 Message-ID: Subject: Re: [PATCH v2 1/2 RESEND] sched/fair: take into account scheduling domain in select_idle_smt() To: Keisuke Nishimura Cc: Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, Dietmar Eggemann , Mel Gorman , Valentin Schneider , Julia Lawall , Xunlei Pang , Abel Wu Content-Type: text/plain; charset="UTF-8" On Wed, 10 Jan 2024 at 18:57, Keisuke Nishimura wrote: > > >> > >> 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. Ah yes indeed. I didn't notice that it was now included in the for_each_cpu_and Reviewed-by: Vincent Guittot > > 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 >