Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2058180pxf; Sat, 27 Mar 2021 01:25:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBrs7OuizDJGmvK4DTmfS2jCEfrDneTEN6ynplQ3UYL5ocnX9mXb9+F6Aj90x3h7GyQYfN X-Received: by 2002:a17:906:9501:: with SMTP id u1mr19610791ejx.324.1616833517296; Sat, 27 Mar 2021 01:25:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616833517; cv=none; d=google.com; s=arc-20160816; b=gnL11ftOOtRm+OUEfaa6ES3njwR81jzg/K5F6rS8EouhUqP0V8ESRzY81F0ywhbxLF zalYMBoDgs1nOC3km+NVLI6MmVVslZI6AuwR3O35tH9c79maz5LDTgbChjN+Bts2bbBT 3xeLMChWp4x3LkaztzuIUo3Ce0CNEDxJRZpoK5PcBtakUkSsFP7WNLQwt71WO8SjWMs+ 6t9Q2+B1J20ZY6j3eVaAtSDsSP5oRGyU1mNASQvmcnLNM768uoT1pVnxAoI/Rw7pi1Qp tOt/8VyNxaX/d2N9BfhdVoJ6X6F0ATjqOO5+ziS9CgD8L5K9wUq+nCa4KVi+GpMC+mGB YkEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=AP/jToosrouwJEDG2+eP3LO3MDKSwgonJ5IGKPGjUdU=; b=MGfsXQTakb/yXqxF2ltb5NC73vDso0ewYUyehVvbrB+lBPBVJ1JsMOVwE7lXUJHR/W Gigz5WAKTs6/qyVeCbugdEunRwfN4+xN8qTrZBxe1Ik8y4+bscgZg5mZ83E45RD3Tq8W Y8u8adWuP70dvVFtIZG1qOXfBXEVHZxCW1z62zvjkjFb0mZoLOuzlMtUpJ3xTfGIy/YC A5fonLVmuIVR/+wb/oC0V1VEXUC84CheJP90SHl41K4jtdVyS7WlLkP61dWsyYs7/+wS 4FpzQuoGwhCKu0ox5cinJ89ENwYxuQtfMJg5L+tKVE+k3gw0d9GSbhkdWIZHpBtcPvA0 NlBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ca25si8749009edb.204.2021.03.27.01.24.54; Sat, 27 Mar 2021 01:25:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231332AbhC0ITc (ORCPT + 99 others); Sat, 27 Mar 2021 04:19:32 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:14932 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbhC0ITB (ORCPT ); Sat, 27 Mar 2021 04:19:01 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4F6sC42WDBzklrN; Sat, 27 Mar 2021 16:17:20 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Sat, 27 Mar 2021 16:18:49 +0800 From: Tian Tao To: , , , , CC: Subject: [PATCH] sched/fair: Remove the redundant check in numa_id_core Date: Sat, 27 Mar 2021 16:19:21 +0800 Message-ID: <1616833161-64375-1-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org the numa_idle_core() function have a little redundant. then this patch move the "idle_core >= 0" check in numa_idle_core() to its caller in update_numa_stats() and then remove the redundant check in !static_branch_likely(&sched_smt_present) check in numa_idle_core. This patch is based on the following discussion: https://lore.kernel.org/lkml/20210322101556.GK15768@suse.de/ Signed-off-by: Tian Tao --- kernel/sched/fair.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6d73bdbb..fbff7f1 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1569,8 +1569,7 @@ numa_type numa_classify(unsigned int imbalance_pct, static inline bool test_idle_cores(int cpu, bool def); static inline int numa_idle_core(int idle_core, int cpu) { - if (!static_branch_likely(&sched_smt_present) || - idle_core >= 0 || !test_idle_cores(cpu, false)) + if (!test_idle_cores(cpu, false)) return idle_core; /* @@ -1622,7 +1621,8 @@ static void update_numa_stats(struct task_numa_env *env, if (ns->idle_cpu == -1) ns->idle_cpu = cpu; - idle_core = numa_idle_core(idle_core, cpu); + if (idle_core >= 0) + idle_core = numa_idle_core(idle_core, cpu); } } rcu_read_unlock(); -- 2.7.4