Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4104221imw; Tue, 12 Jul 2022 01:43:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s4Hixidp0PMQ1pObkfb18NUuTCLQA8s2xopE8jxcUON5uVGVN+X3wrvB4HXHM2XnGlqdpf X-Received: by 2002:a17:907:9627:b0:72b:6d22:4334 with SMTP id gb39-20020a170907962700b0072b6d224334mr5427483ejc.506.1657615405657; Tue, 12 Jul 2022 01:43:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657615405; cv=none; d=google.com; s=arc-20160816; b=euhszyJSIor83jYmQaftmR8LILFUiGhqZtqh87awTY3VXx9+OVWORnyxRHAil0+qMk CG71A9l4x3wL4vzbz7ct1nyi1f4z5UKiPJhLt5xCEckC5+aKjJxifAZ/cY/gMvADjzHr 37j1EXvx1neVsUB+homDFGs9KGyMJD2e3vpRDvmVpC+jDMGsdZahpC8LcNngJ0xYONqT 5R3UCKoGdDtoiOeQ2z8Zf6PzahvT6DRZMSMlEeNyo9MOT/Pf7huGAYnHtJNJIRqXSzxq ZabAYfMLHysqmThhoqtjscHYiwC1JHzk2jq9BCQG2Wzz4+GvVOHU++yB8ajzi7uj06WC xABg== 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=tPCKm2gvds2lzYICLyS9Zh4eZd8vzB/7YXbaR5AiWlU=; b=N/+S0Gn9E38b2ERATrVW+4gcsPQJwZ867g9iOgaYFpZ2yMKLIaNZvtdLzsFfOsh1/Q b4iBE36ZS3t1Odc10h60cq+3gmsVFruGIB6VPmxnfONwbfZ3qPFUS47g2CtzJwPst7Kl KFRUvWXVy8b0en2FkfY926ueLQxC6/R97+E+kjMRsgBD1mlnJ4aYuGqi02VU5P1oxmdb zekKvHgLwiU5pwAToiCRu+ueBpX9LBOLSEvloXkDbf5A+iL0lENgpuSFSgx+Xcz/8EaU 5xs/v64J5RcEdr/90XmmwqENVqm/ZvGJYZShzE1/F3hh92+/5WEFABOj0p+807w2yV5K GwwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=UDYGJcUn; 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 d15-20020a056402400f00b004376b600290si13401721eda.350.2022.07.12.01.42.59; Tue, 12 Jul 2022 01:43:25 -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=UDYGJcUn; 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 S232741AbiGLIWd (ORCPT + 99 others); Tue, 12 Jul 2022 04:22:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232786AbiGLIV7 (ORCPT ); Tue, 12 Jul 2022 04:21:59 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A842EA5E41 for ; Tue, 12 Jul 2022 01:21:27 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id 89-20020a17090a09e200b001ef7638e536so10678888pjo.3 for ; Tue, 12 Jul 2022 01:21:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tPCKm2gvds2lzYICLyS9Zh4eZd8vzB/7YXbaR5AiWlU=; b=UDYGJcUnyrLKSaNyp+xCZcL78T71vqVdok+I4gDUp2YoeH8l2Jy9VbsqZiNUqN3oG/ DC/URdM8RLJtJaiExWX1K1mvXC2FKtHenFA/Mn0QwTdKA/nrpA5Rfm+8ICHAXB6tfJKx +FXQcoX1GIf/iqNy6+LRuW2ySoNDTI+94dmiAzHH0UkLY/AIL9cqHBtbDWsCUYwn0npz NoESXMEIfQYWgotxBh7wc7UP9w0YtMInEcxvfBYL7rdOIWMll98b1FqaaEvt4xJ0zlJS s67mSkZsvNdWS99YeEjPIm/oxaXyScceiYokNnIbKybpRaV8jN2bmJ1Iur42bqet1Bjz C25g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tPCKm2gvds2lzYICLyS9Zh4eZd8vzB/7YXbaR5AiWlU=; b=2+b6DBq5QEDo0l11s7nC5WaKAIH85jiRx8v+QQSpqBoiUXk/hom+JmTYKnPmoREEGt dAkYCeWlBk85CFWNIp1egti5wJXVJY8M6cbY6WE182lI3GrEuQgrYca9sauV4hMCfAuk PaCmRsIC9zGBcdRelMKe2BNiy77IYaQhY5kJwVi27YldfU6V/W9VEtApTod07CoXE9ER jUZYMQd9fHgU3n56igCOjPIaXHjBhze8PROJ9UEGrKZNSDLfEFHVfzRPynbzVc7o95gS PWPQHq5U4UUH58WjZjc0PVGuyUkYkLjbEeXd2CQ3MdSwsi9G+szBxXNEG6kX8d4R3hbE zTGQ== X-Gm-Message-State: AJIora9o9G1HwVy4XEz1eqphv1RhCP9c+R52YkyRIL2Uum2o0mjpBEul 0usnnj+qa8axyACzEAN5YYUM0g== X-Received: by 2002:a17:903:244c:b0:16c:594b:3f4a with SMTP id l12-20020a170903244c00b0016c594b3f4amr3429526pls.145.1657614087265; Tue, 12 Jul 2022 01:21:27 -0700 (PDT) Received: from C02DV8HUMD6R.bytedance.net ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id s13-20020aa78bcd000000b0050dc762816dsm6114428pfd.71.2022.07.12.01.21.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jul 2022 01:21:27 -0700 (PDT) From: Abel Wu To: Peter Zijlstra , Mel Gorman , Vincent Guittot Cc: Josh Don , Chen Yu , linux-kernel@vger.kernel.org, Abel Wu Subject: [PATCH 4/5] sched/fair: avoid double search on same cpu Date: Tue, 12 Jul 2022 16:20:35 +0800 Message-Id: <20220712082036.5130-5-wuyun.abel@bytedance.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220712082036.5130-1-wuyun.abel@bytedance.com> References: <20220712082036.5130-1-wuyun.abel@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, T_SCC_BODY_TEXT_LINE 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 The prev cpu is checked at the beginning of SIS, and it's unlikely to be idle before the second check in select_idle_smt(). So we'd better focus on its SMT siblings. Signed-off-by: Abel Wu Reviewed-by: Josh Don --- kernel/sched/fair.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0d7e8555bcf9..e4cf000604fc 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6344,6 +6344,8 @@ static int select_idle_smt(struct task_struct *p, int target) int cpu; for_each_cpu_and(cpu, cpu_smt_mask(target), p->cpus_ptr) { + if (cpu == target) + continue; if (available_idle_cpu(cpu) || sched_idle_cpu(cpu)) return cpu; } -- 2.31.1