Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2030867iog; Sun, 19 Jun 2022 05:38:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uwTdD3MNmTLI/glLvMuzQhA5ZfOp6TdjHbjgZKlRZChopdyRiOLIGvMWn9nLRCKkH9TVq2 X-Received: by 2002:a17:907:6287:b0:6e1:6ac:c769 with SMTP id nd7-20020a170907628700b006e106acc769mr16987696ejc.388.1655642311037; Sun, 19 Jun 2022 05:38:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655642311; cv=none; d=google.com; s=arc-20160816; b=x2SJHZMJGrdrA0NUw/q5+JSx7jPZGU/C+a7eZeGqekLMQmEa7C8X/3G519GQn5sYMF Vr6I6r5m1dEqotGfuaBNxV/8O34AHhbGbUmIvzb0OqOTpED10qgbMUKGp4Cj8bvldzgJ 8RaZFQ+/er6aQos7ZAic97IsQ6SbHr48D8/daMZpND83bG2IkEsyd3e3T6XR2ye6Vsoy UHRPA+jruQOsma5hQ0SyBHwniHzUttjUHSIYux6uWFPwef6ZTZ7welBl7jUFRDdkJHQy loxNcILifWZ2tddR0cPTgCLiG7DdVKOI8wGNFhr1MiNpPd7Ig1mGmJjrFvlwHc2bweD+ B9aQ== 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=7yHMFqrpDoGhsUBFFuG/t0+9zUYaObGcD9IoHIQWIsE=; b=Q4ppxuCCVOfTEs34BLdipmDL5wJHOgQt08eu2jCSTe+Yv1ZLIDka8GyiXm4fm73LI3 K86VcWeuEfvbYkyx57tJyfMkwTHNQtEOsyMOFS0mXTQ/zaTN61hO+CvundWatPfZ7Pwa vqGqAUILPV5Zcb9+ytmWmiAYwR0k46P7aHBnUcfbdUJHgW8JjTEjJDUX5x4LxCBABIn4 nNTYgvdFZGLJNdPaOs8tUet/TXDpRwi6blZ+s3fAnwJY7YD6NHFtg3AzKhIjzBVaq/ez 5b9hWDOqNWI2ZkNCNjArmfFyMXtXfwlBftEIN9iCH4BfriCf76pJ2RWLmVy1JapDgTBi 02iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=QLyrlDSR; 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 g19-20020a170906349300b0071208964108si9660192ejb.635.2022.06.19.05.38.05; Sun, 19 Jun 2022 05:38:31 -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=QLyrlDSR; 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 S237050AbiFSMFh (ORCPT + 99 others); Sun, 19 Jun 2022 08:05:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236999AbiFSMFd (ORCPT ); Sun, 19 Jun 2022 08:05:33 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B954910551 for ; Sun, 19 Jun 2022 05:05:31 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id f16so6533372pjj.1 for ; Sun, 19 Jun 2022 05:05:31 -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=7yHMFqrpDoGhsUBFFuG/t0+9zUYaObGcD9IoHIQWIsE=; b=QLyrlDSRfFQAY8o/woQAVrzpPAlujEGqvIF3ZR5UeS3sG0WopkjWZD5U5PqQrA4m/m pvTECNJXhCSb2BDedJzI1bLrGZoWEKezmaHns6vuFnQX7k7lGpknWNJvtTR06Lme9zVr gE5HriRvNvsLBtIP2jn4JDNSpp0UKK/cnEp+ckeRQtYuE9mHuta995F0FAJg0twhHaCP pxxN3qmMfr7Pv3y8tiKAJ1Z/g0cPHuXeXvExWqZ9hKM1YJX6/Fqt8eVEwFZRK9b0TF8F XDIJ1Oj+HFHV5zM8U+DKzRO0cX0KmQRx+rdPmsXjbLf5Et6fFkHQsdqRz0nr9rFa1D2U t0mg== 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=7yHMFqrpDoGhsUBFFuG/t0+9zUYaObGcD9IoHIQWIsE=; b=Din7PATxVsRHKncHR50R/EebWQIMBLzO3Y/DxeztuB5gLY+nBYLgETw+twEoy4BkCV soKv0vdAKHzJnIpgglICjlI2qEwZjAu1LSi4i6H5AndAjH4ggaoPp/4PlXh0M9er50vm 2750TMUmxdOmov9Sbws514i5frzDxAjkHEAEkegWu78T6w1BKLZjudbUnRVY8k/cqW7U ddI7dNJ5a7aZkH0el8YAqG0obnOjnFIesbwYI70WJWBJUjkdVuOotOxEj3K1iZFtoVgP 2aDyBP+X6iHL3Zvgr7Cbz9rLJ7ffZbyM7UybqP6x0Ftj09jjzj3cCpH3CXC/QN1jE/ZV ZlTQ== X-Gm-Message-State: AJIora+8W/lMwbSWSyIwmtrgrtbT2hFj/CiMPIk8cdPGd8HVviuxzusx rnrEZp+EosfnG/lQmp6pseiVLg== X-Received: by 2002:a17:90a:fd13:b0:1ec:7a40:3b5 with SMTP id cv19-20020a17090afd1300b001ec7a4003b5mr12625505pjb.8.1655640331252; Sun, 19 Jun 2022 05:05:31 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.246]) by smtp.gmail.com with ESMTPSA id cp16-20020a170902e79000b0015e8d4eb1d5sm1594038plb.31.2022.06.19.05.05.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jun 2022 05:05:30 -0700 (PDT) From: Abel Wu To: Peter Zijlstra , Mel Gorman , Vincent Guittot Cc: Josh Don , Chen Yu , Tim Chen , K Prateek Nayak , "Gautham R . Shenoy" , linux-kernel@vger.kernel.org, Abel Wu Subject: [PATCH v4 3/7] sched/fair: avoid double search on same cpu Date: Sun, 19 Jun 2022 20:04:47 +0800 Message-Id: <20220619120451.95251-4-wuyun.abel@bytedance.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220619120451.95251-1-wuyun.abel@bytedance.com> References: <20220619120451.95251-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 only on its SMT siblings. Signed-off-by: Abel Wu --- kernel/sched/fair.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e57d7cdf46ce..aba1dad19574 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6290,6 +6290,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