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 EBEADC4332F for ; Thu, 22 Dec 2022 16:57:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231129AbiLVQ5R (ORCPT ); Thu, 22 Dec 2022 11:57:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbiLVQ5N (ORCPT ); Thu, 22 Dec 2022 11:57:13 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B86BC18E07 for ; Thu, 22 Dec 2022 08:56:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671728186; 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=zlp17/58Tt0fnoE4NSJJ90eJ41XW+fAlC4kIuMp7uqI=; b=StdTWGX7CE/W1uIFRD3QUHoLrEmK49/akKCNSIcDWL/CqCHURk5vye2Yy7/gx0iQG5keYH aYwRahleWzZB/ydVvQOtcaa2KjhA/Cfrkc6r4eHqdwRaz28BE4QXPYja4n8x4vFmAq8+Up ulMYpcdHDowCfU9rXEQ+0e15xctjXas= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-567-AgSSBaIlO-mPM10iqZnQXw-1; Thu, 22 Dec 2022 11:56:25 -0500 X-MC-Unique: AgSSBaIlO-mPM10iqZnQXw-1 Received: by mail-wr1-f71.google.com with SMTP id q16-20020adfab10000000b00271460582b6so523618wrc.5 for ; Thu, 22 Dec 2022 08:56:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zlp17/58Tt0fnoE4NSJJ90eJ41XW+fAlC4kIuMp7uqI=; b=e+H5aqZ9/R7j9qiVA2dAC9pOoj998yh/k+5izLMg93GwDXV2mdvPiMB/FHrP7OfWv3 halVVcDo4X/hdXxPMa9J6pqA49DA+9kmT0HXOZpQaMH7Zm9IJiUaPSFeNW5SdZGH/9ep K0a1VKvm3iERZxQ5uGm0bjxjZpefqMajnkkMLbwO1tuSHtuyGdbGy8hCkOkCR8dqzEmM Qd2nsAtLDt/ReBNUH0Ye49+NRxgY2wIrHdWwqvfb4vCJSgwo7T0xI4SaxjpyzJAk7R8W uT1+E7Q9olc65ghsrvJP87tHe4KWHHV3WZkmP0IrzLDDUuuzJEnAbcZ1K3P/40x2gGdn xcTQ== X-Gm-Message-State: AFqh2kqYBmWy/fQ79nwlIItyBsz0JXKVBL5+hLeVAI4vbdJ/HQIYPGFd 3T65oOwdVOfEUhHPL7EfBUHkGMlp1F3kKaH8A4GkIP0/RiMG20WK7bOwM5LMZ/uUay/BfPKUoir D38s5LFcVlZMgSA4QOONGAqAt X-Received: by 2002:a1c:3887:0:b0:3d2:26cd:3b1e with SMTP id f129-20020a1c3887000000b003d226cd3b1emr4857119wma.28.1671728184562; Thu, 22 Dec 2022 08:56:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXsRrPQh7eA2NY2acTEbP3AJ32bo0iEjaZr7kwlePoHW7ktgOSmPd+0CFvutXpFHlHqQDiu1LQ== X-Received: by 2002:a1c:3887:0:b0:3d2:26cd:3b1e with SMTP id f129-20020a1c3887000000b003d226cd3b1emr4857106wma.28.1671728184413; Thu, 22 Dec 2022 08:56:24 -0800 (PST) Received: from vschneid.remote.csb ([154.57.232.159]) by smtp.gmail.com with ESMTPSA id o27-20020a05600c511b00b003c6f8d30e40sm7098863wms.31.2022.12.22.08.56.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Dec 2022 08:56:23 -0800 (PST) From: Valentin Schneider To: Ricardo Neri , "Peter Zijlstra (Intel)" , Juri Lelli , Vincent Guittot Cc: Ricardo Neri , "Ravi V. Shankar" , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Len Brown , Mel Gorman , "Rafael J. Wysocki" , Srinivas Pandruvada , Steven Rostedt , Tim Chen , x86@kernel.org, linux-kernel@vger.kernel.org, Ricardo Neri , "Tim C . Chen" Subject: Re: [PATCH v2 4/7] sched/fair: Introduce sched_smt_siblings_idle() In-Reply-To: <20221122203532.15013-5-ricardo.neri-calderon@linux.intel.com> References: <20221122203532.15013-1-ricardo.neri-calderon@linux.intel.com> <20221122203532.15013-5-ricardo.neri-calderon@linux.intel.com> Date: Thu, 22 Dec 2022 16:56:22 +0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/11/22 12:35, Ricardo Neri wrote: > Architectures that implement arch_asym_cpu_priority() may need to know the > idle state of the SMT siblings of a CPU. The scheduler has this information > and functionality. Expose it. > > Move the existing functionality outside of the NUMA code. > test_idle_cores() does something similar without an iteration, did you consider using that instead? > Cc: Ben Segall > Cc: Daniel Bristot de Oliveira > Cc: Dietmar Eggemann > Cc: Len Brown > Cc: Mel Gorman > Cc: Rafael J. Wysocki > Cc: Srinivas Pandruvada > Cc: Steven Rostedt > Cc: Tim C. Chen > Cc: Valentin Schneider > Cc: x86@kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Ricardo Neri > --- > Changes since v1: > * Introduced this patch. > --- > include/linux/sched.h | 2 ++ > kernel/sched/fair.c | 39 ++++++++++++++++++++++----------------- > 2 files changed, 24 insertions(+), 17 deletions(-) > > diff --git a/include/linux/sched.h b/include/linux/sched.h > index ffb6eb55cd13..0d01c64ac737 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -2426,4 +2426,6 @@ static inline void sched_core_fork(struct task_struct *p) { } > > extern void sched_set_stop_task(int cpu, struct task_struct *stop); > > +extern bool sched_smt_siblings_idle(int cpu); > + > #endif > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 0e4251f83807..9517c48df50e 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -1052,6 +1052,28 @@ update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se) > * Scheduling class queueing methods: > */ > > +static inline bool is_core_idle(int cpu) > +{ > +#ifdef CONFIG_SCHED_SMT > + int sibling; > + > + for_each_cpu(sibling, cpu_smt_mask(cpu)) { > + if (cpu == sibling) > + continue; > + > + if (!idle_cpu(sibling)) > + return false; > + } > +#endif > + > + return true; > +} > + > +bool sched_smt_siblings_idle(int cpu) > +{ > + return is_core_idle(cpu); > +} > + > #ifdef CONFIG_NUMA > #define NUMA_IMBALANCE_MIN 2 > > @@ -1691,23 +1713,6 @@ struct numa_stats { > int idle_cpu; > }; > > -static inline bool is_core_idle(int cpu) > -{ > -#ifdef CONFIG_SCHED_SMT > - int sibling; > - > - for_each_cpu(sibling, cpu_smt_mask(cpu)) { > - if (cpu == sibling) > - continue; > - > - if (!idle_cpu(sibling)) > - return false; > - } > -#endif > - > - return true; > -} > - > struct task_numa_env { > struct task_struct *p; > > -- > 2.25.1