From patchwork Tue Jun 20 08:07:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 110344 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3517415vqr; Tue, 20 Jun 2023 01:46:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ42XhlNoxYm80yd8ZbBY4jqX4LQfmyYgTUWcIluiRiYELDgHSPFfc8cxrpP49vrCC7AkiK7 X-Received: by 2002:a05:6a21:6d8e:b0:10b:764b:a942 with SMTP id wl14-20020a056a216d8e00b0010b764ba942mr22374959pzb.11.1687250811052; Tue, 20 Jun 2023 01:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687250811; cv=none; d=google.com; s=arc-20160816; b=A/ERdyeigL0IJUVRWZm97wyBGCdLLln8io5MlD+lm7Wfw32ZKmZRmAGvY0DNm5/I3a u3gZ3TULrI6gDzmY3MNbms5/YjaMeQ2YgZHfrWYmgYehHkf8xY+0caf2fWrpKSsQdskp USbowH9YxxGnl0pSegTcX835xSYc7b9VppETsb3JcSrcQgsHffShN+uJWvwYapL6Pfgk QBTp6O2i5WVFBxNbMH/u0DpEYQS3wIoVbP0l1cY7B3Lz9Uo8WHBRvhkVNehOJmqu1lKm Xuu5edQIGgiklMsv849XDxtZApJySlFbOoZ9woRQAnfkoZLoTjFlw0Ys5u/UodUfE8Jm 1+0Q== 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 :message-id:date:subject:cc:to:from; bh=iF/BvrXZF4Knfaowv7SJ7XY7/466NoQVsjzV8E4bivU=; b=oUKjzR5vNczmUdGZglh6dnQe68KkbKCl2mr/gYJvgCPvVhBVbUKBlOvdllLKz+HcRv 7OAoH8gCa/BgZDn7KXUSCGnlboi/jMjDGgo2Qy0XRDaTrMJh7tQhW2knQhbVTqJmO+9L S7bg36PLAKqesCR96u1+jgb+1DAmyyKg8edtEsx7ZIGpmC/UjjkhKoDWtOQTDdXABu2y Aka2XL82F2/BRse59sDOjS8aRMns4rfNgpOZom2IzYD/z7/FzRcjzcmvHD/VRMgt3Use 16detGHsWsvzGdMNs9ordYPJdKOawQuOJZOxzIXeRz7n7N0Qge3NXn1XmN5O9Jh6lBt0 10dA== ARC-Authentication-Results: i=1; mx.google.com; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w64-20020a638243000000b0054fd77fe97asi1250841pgd.267.2023.06.20.01.46.35; Tue, 20 Jun 2023 01:46:51 -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; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231149AbjFTII2 (ORCPT + 99 others); Tue, 20 Jun 2023 04:08:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbjFTIIZ (ORCPT ); Tue, 20 Jun 2023 04:08:25 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57873C7 for ; Tue, 20 Jun 2023 01:08:24 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QlfPn4wprzTl98; Tue, 20 Jun 2023 16:07:41 +0800 (CST) Received: from huawei.com (10.175.104.170) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 20 Jun 2023 16:08:21 +0800 From: Miaohe Lin To: , , , CC: , , , , , , , Subject: [PATCH] sched/fair: Use recent_used_cpu to test p->cpus_ptr Date: Tue, 20 Jun 2023 16:07:47 +0800 Message-ID: <20230620080747.359122-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Originating-IP: [10.175.104.170] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769210706534540327?= X-GMAIL-MSGID: =?utf-8?q?1769210706534540327?= When checking whether a recently used CPU can be a potential idle candidate, recent_used_cpu should be used to test p->cpus_ptr as p->recent_used_cpu is not equal to recent_used_cpu and candidate decision is made based on recent_used_cpu here. Fixes: 89aafd67f28c ("sched/fair: Use prev instead of new target as recent_used_cpu") Signed-off-by: Miaohe Lin Reviewed-by: Phil Auld 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 7666dbc2b788..3cc06cfca350 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7156,7 +7156,7 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target) recent_used_cpu != target && cpus_share_cache(recent_used_cpu, target) && (available_idle_cpu(recent_used_cpu) || sched_idle_cpu(recent_used_cpu)) && - cpumask_test_cpu(p->recent_used_cpu, p->cpus_ptr) && + cpumask_test_cpu(recent_used_cpu, p->cpus_ptr) && asym_fits_cpu(task_util, util_min, util_max, recent_used_cpu)) { return recent_used_cpu; }