From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61DC8C43334 for ; Thu, 21 Jul 2022 10:35:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9j2zwH6D1Oy57VRW8LHwVxMak2vFIICtJCE9KCOOClg=; b=KcR+ruGk9B0DMo LEPF6V0aKI5pCTsMDoha4/vujLo0MOy/gFd56BP7ceW7iheZsHf4e8PXfQ9BPXUCX8onLh+oDuqcy YCfRJqn/FdtyHCdVPDOL8dpzHXP/8UWAXaK6H7QIy5kPcJrNcEHp2/p6oQjkv+M/0KcwnqfaTeP00 qFSxcgIZGSKIOnNur1aEaxz+W6A8lKLAVjN1EOLUIenDW6nr0YnaWQGNIU1lRT+jthUtjzmwQgUWm bo1mJKoZ8nKG20Sn4fN5H93uIgp1VIcrq0LksyoWZ8+deKPmoCxmpXbIbeRHuSgxCZ0YN42uDSnal fslbLrASO76z7cD+V5pQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oETVU-003teP-0F; Thu, 21 Jul 2022 10:34:12 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oETVR-003tbx-Kf for linux-arm-kernel@bombadil.infradead.org; Thu, 21 Jul 2022 10:34:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=t1D1TNt+y52e8I+wqbglpFwxSIDJ0TYIEuP5FTx39Yo=; b=dr2GoOd0mq3CZ8Ux2Uan1oyT9E YKvT+ZLRogJjKVP/ka87islaEmsiCEnazbi07izitnEBmhhPnBTGZSdw+Z0Ms4ZnNZ58cqSdDaavD h6OMQvTkzyFVnw4ParCLGxq31+Rye4PzmffCkL7oIq4PlPIrYxocnyCEuiAxFHx2tQUB3CkZQ2W77 sP/lQJU4KAG95iKxrpx6VLrBSk6aHngr6kieXqa6UpAyZKj5cI9o/VdCJVHXUqunzWJkr++Dyii69 7450sNFuiDKk4QKzKZplrUWohKVa8U3lYOzlHz01qM/TpU/uf3OvNH4iylKhrshXX4dOHtlP6WV2x 7+oiOuWw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oETVH-005Wpc-M1; Thu, 21 Jul 2022 10:34:00 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 42DB0980BBE; Thu, 21 Jul 2022 12:33:57 +0200 (CEST) Date: Thu, 21 Jul 2022 12:33:57 +0200 From: Peter Zijlstra To: Barry Song <21cnbao@gmail.com> Cc: Yicong Yang , Ingo Molnar , Juri Lelli , Vincent Guittot , Tim Chen , "Gautham R. Shenoy" , LKML , LAK , Dietmar Eggemann , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira , prime.zeng@huawei.com, Jonathan Cameron , ego@linux.vnet.ibm.com, Srikar Dronamraju , Linuxarm , Guodong Xu , hesham.almatary@huawei.com, john.garry@huawei.com, Yang Shen , kprateek.nayak@amd.com, Chen Yu , wuyun.abel@bytedance.com Subject: Re: [RESEND PATCH v5 2/2] sched/fair: Scan cluster before scanning LLC in wake-up path Message-ID: References: <20220720081150.22167-1-yangyicong@hisilicon.com> <20220720081150.22167-3-yangyicong@hisilicon.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jul 21, 2022 at 09:38:04PM +1200, Barry Song wrote: > On Wed, Jul 20, 2022 at 11:15 PM Peter Zijlstra wrote: > > > > On Wed, Jul 20, 2022 at 04:11:50PM +0800, Yicong Yang wrote: > > > + /* TODO: Support SMT system with cluster topology */ > > > + if (!sched_smt_active() && sd) { > > > + for_each_cpu_and(cpu, cpus, sched_domain_span(sd)) { > > > > So that's no SMT and no wrap iteration.. > > > > Does something like this work? > > > > --- > > --- a/kernel/sched/fair.c > > +++ b/kernel/sched/fair.c > > @@ -6437,6 +6437,30 @@ static int select_idle_cpu(struct task_s > > } > > } > > > > + if (IS_ENABLED(CONFIG_SCHED_CLUSTER) && > > + static_branch_unlikely(&sched_cluster_active)) { > > + struct sched_domain *sdc = rcu_dereference(per_cpu(sd_cluster, target)); > > + if (sdc) { > > + for_each_cpu_wrap(cpu, sched_domain_span(sdc), target + 1) { > > + if (!cpumask_test_cpu(cpu, cpus)) > > + continue; > > + > > + if (has_idle_core) { > > + i = select_idle_core(p, cpu, cpus, &idle_cpu); > > + if ((unsigned int)i < nr_cpumask_bits) > > + return i; > > + } else { > > + if (--nr <= 0) > > + return -1; > > + idle_cpu = __select_idle_cpu(cpu, p); > > + if ((unsigned int)idle_cpu < nr_cpumask_bits) > > + break; > > Guess here it should be "return idle_cpu", but not "break". as "break" > will make us scan more > other cpus outside the cluster if we have found idle_cpu within the cluster. > > Yicong, > Please test Peter's code with the above change. Indeed. Sorry for that. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel