Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp258110rwi; Wed, 26 Oct 2022 00:01:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4baZGhb3Re/w3Cxpqq3dHltxj23ZN438jqOx/gFvmaUfwd5n5hw1M9RH3fUXSp1NnuE1dP X-Received: by 2002:a17:902:8205:b0:185:33e:2a0e with SMTP id x5-20020a170902820500b00185033e2a0emr41744100pln.92.1666767704027; Wed, 26 Oct 2022 00:01:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666767704; cv=none; d=google.com; s=arc-20160816; b=OQSznTX5uR2HysGBjaP+wHUGn9OoR5Pb47i1LWsbQVQ9GuEvL4GgPL5SkSi3uQ75J9 O0p5/sekcjme3BrchxD/9mqmlWYqJMAcSftA7cJHimReHKrqAj+0vM598bGw4/x8Iu9D WI4kkhVkIv8lZCmScjILZaoYWnYGi2LdlikDYQuoNTIJbk/0CTvNpn3nNwKGQrGlBHDH hX7FbbeHrPcliij7jWOF/2kORhWAjZE6noGTzaE46v3t15AtdEBxm6JpI/Ely1rwDnM/ j+L11xzqPVqsZ4giA4uwQ5T0m2Lf3roGDtSz0CrMmP6j8f5NmpjH5628oTXSKM/A6GzH bdMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HIlTSDWbVtqkeVttUcwmGvIfocdqv0kcWKfN4GKoIZ8=; b=PobmtvYfWkXYSWelW0p3US6FagYGwMWivlcDVR7EOpK4vn8s9VBiPi8mHHFLbGJvAK zzrRxx9nRyBUUGcFrrbNrMLe8tYMm6asJtw54rabHRJk9uSN7pqlYkxLMHtMw99fgpiL b8YFhVDeHIO9yhCzlZgshuanIu6jCjZTxgQPha1zhnEXZD/KjtciMXXK9YGpJn2OwX4Q xhPHXZ9AFu3hYPQg9FxcOOLBo45r8NEGS7tsxKXUwutrLHcNG715iOO5UbTTehlLD596 atSAWpGgrX7b5b42s5Kfwex8fNe8yO6Fs64vCFaLkf6mXmFCSIatW2QDAlL3496QwwPg aUdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=uaadtIEG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020a62ce03000000b0056bf7935ac1si6002588pfg.145.2022.10.26.00.01.27; Wed, 26 Oct 2022 00:01:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=uaadtIEG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233084AbiJZGnb (ORCPT + 99 others); Wed, 26 Oct 2022 02:43:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232981AbiJZGnU (ORCPT ); Wed, 26 Oct 2022 02:43:20 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79407AE851 for ; Tue, 25 Oct 2022 23:43:18 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id e4so10457238pfl.2 for ; Tue, 25 Oct 2022 23:43:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HIlTSDWbVtqkeVttUcwmGvIfocdqv0kcWKfN4GKoIZ8=; b=uaadtIEGpfWSDRPGzX2Ka4GTJgjPlMo5p28PF2vQeBzSIzSSz0Ox1TrE239LPGLjZj LTY2wizD6N0vBeZ8ZY+dvZPeYIpiqkjTey5L5yHwRz8/UsLboW0ZOwxnOIIPw1C77jqZ JFTluMO9P4NxRWnUqe/EbELATGUOmdK5V6SkOSgrFzSwlWXUm8EA8URFCTQMV8b8n8WK bpXe5fmTMBZ6/70pOdXuSmpdWvFaDvt+YDlgJtvqiLtYEnbqguIF6dxy8/VDl+8AKer/ 2lrvrXGEdF68wLKMUNVeU2hLLaWuph/WmGLcT59HI1PwqWzhLFqG3GwBBPACjgSpwFJd 23Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HIlTSDWbVtqkeVttUcwmGvIfocdqv0kcWKfN4GKoIZ8=; b=Zp+J/10E7dPym7M5CKB8EbyRBpWLgQc9hpKPIU5PDM/NsRLMSIox6gHTFZD/izfCSK Imcsa1SqfgUWWFsGPwJvsFmAr/L68Sh/JXwPL8EHkl/Lbc/OADN+0Y7Np8gLLTiH2arV hXkupVpwcT8ll6J8IiAoARk2O4h3BjipGWNs29eI6q1NzfKtsgEHKTF19IRNOAbcnjTL LITyce5STUFeQq/iUKEmZIjmDelQFzNTjKUzWb+iSKYV44wxqy+ANl66lSxxMdwn0Dtj Ge2EEXBLMR0zaSAEnR2+Ek88d8jP3C9h4ytCNlTspf2sPGQuM3LNdpxaxiZ05lHAULA1 +Lvg== X-Gm-Message-State: ACrzQf26foSH5H1oFA15HoJ3fNUym04LdS+TyeFncu67AZnK/YabvAsC +vQ0yfS0XTDhZSkH016ox86rnQ== X-Received: by 2002:a63:90c1:0:b0:45f:c9a7:15c3 with SMTP id a184-20020a6390c1000000b0045fc9a715c3mr36038681pge.304.1666766597869; Tue, 25 Oct 2022 23:43:17 -0700 (PDT) Received: from C02G87K0MD6R.bytedance.net ([139.177.225.228]) by smtp.gmail.com with ESMTPSA id b62-20020a621b41000000b0056b932f3280sm2363187pfb.103.2022.10.25.23.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 23:43:17 -0700 (PDT) From: Hao Jia To: mingo@redhat.com, peterz@infradead.org, mingo@kernel.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, mgorman@techsingularity.net Cc: linux-kernel@vger.kernel.org, Hao Jia Subject: [PATCH v2 1/2] sched/numa: Stop an exhastive search if an idle core is found Date: Wed, 26 Oct 2022 14:42:59 +0800 Message-Id: <20221026064300.78869-2-jiahao.os@bytedance.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20221026064300.78869-1-jiahao.os@bytedance.com> References: <20221026064300.78869-1-jiahao.os@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 In update_numa_stats() we try to find an idle cpu on the NUMA node, preferably an idle core. we can stop looking for the next idle core or idle cpu after finding an idle core. But we can't stop the whole loop of scanning the CPU, because we need to calculate approximate NUMA stats at a point in time. For example, the src and dst nr_running is needed by task_numa_find_cpu(). Signed-off-by: Hao Jia Acked-by: Mel Gorman --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e4a0b8bd941c..dfcb620bfe50 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1792,7 +1792,7 @@ static void update_numa_stats(struct task_numa_env *env, ns->nr_running += rq->cfs.h_nr_running; ns->compute_capacity += capacity_of(cpu); - if (find_idle && !rq->nr_running && idle_cpu(cpu)) { + if (find_idle && idle_core < 0 && !rq->nr_running && idle_cpu(cpu)) { if (READ_ONCE(rq->numa_migrate_on) || !cpumask_test_cpu(cpu, env->p->cpus_ptr)) continue; -- 2.37.0