Message ID | 20221026064300.78869-2-jiahao.os@bytedance.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp96964wru; Wed, 26 Oct 2022 00:01:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4N7U55Ywz3bdSH226p93imUkfqaIvPuq80FfU7UN/Bhu3pUL94nzGlOQOC+RmBjsuU/Rha X-Received: by 2002:a65:6c08:0:b0:448:c216:fe9 with SMTP id y8-20020a656c08000000b00448c2160fe9mr35687036pgu.243.1666767674112; Wed, 26 Oct 2022 00:01:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666767674; cv=none; d=google.com; s=arc-20160816; b=l7/mc0Q11G1lVgoGyOVScJLeZCxTPzvVVJGRGl//sVxN6VeBRNydDjceWNfFgD63b/ hfhDq40k8QtY9rAwHNtw+7+lRewepErJ/UZAH5D4JDMxYOWj9Q1X3VGciay+1wSJ4Gue R/GWvvGuxahhncI3w9Q9y8Fk3Hod3F9ci7MXnJbhSGApdOUqITg/ZCFc2Uj4t9uLVMYl BYGcII8NaRvvjmPT5l2+Dw8Wzo/lb954kV1pHy9PDO8HhxVUsF9qniWpqrIMnEV3cSHh mX51j5zFxJKuCyRf4sBpwqdrfxtHlmErlb5Z83fawF6GxvQwhciepqAqZL/4jaQp9FUF lmSg== 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 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.00.33; Wed, 26 Oct 2022 00:01:14 -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 <rfc822;pwkd43@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; Tue, 25 Oct 2022 23:43:18 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id e4so10457238pfl.2 for <linux-kernel@vger.kernel.org>; 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 <jiahao.os@bytedance.com> 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 <jiahao.os@bytedance.com> 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747732580558996488?= X-GMAIL-MSGID: =?utf-8?q?1747732580558996488?= |
Series |
Clean up the process of scanning the CPU for some functions
|
|
Commit Message
Hao Jia
Oct. 26, 2022, 6:42 a.m. UTC
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 <jiahao.os@bytedance.com> Acked-by: Mel Gorman <mgorman@techsingularity.net> --- 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;