Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp315999rdb; Sat, 30 Sep 2023 05:51:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGimxgI0eSZldMJumeZICSHDfHcw/HCS/Q6hYlgVMRp/X9UN9mqOgIw9KiJ33UE7j+l+FGt X-Received: by 2002:a17:90b:1b03:b0:268:1354:7b03 with SMTP id nu3-20020a17090b1b0300b0026813547b03mr6763524pjb.12.1696078289402; Sat, 30 Sep 2023 05:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696078289; cv=none; d=google.com; s=arc-20160816; b=b1vlaCbs8/qBKuj1BCkBmTIatUq8qNqEhgYBS40FNlLLm7vqAakV6HPocp9droDw3e d8RfGCJ713dj0akFA79KCtcUOjEyzTstS5w1TiPaiiD3mLFffDqzsNyT4wfMsXgDC3vq oy6TJXyfo1Bf1rTYyM1+9KZUC1Ab1s6jY26kS4Om4HcHGsMXr4ZLYZVstTi8/894hWoV vq6yaClJeCL0HiEgaUHmlgnoxpYoPi5S0dKM+YZtx+rLPXOP9Qk6JmSngjGPdSklshdH NflCcRXMP9+NUEin8tpekYJAMYE2+THpc7FuSoyDwYSh2jqeYNXV8bYSLP8k3W+m1CP+ p/+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=dg7ZE2riebMxnlklSPd0ZSC8rblqF7vtClAccSSQRrM=; fh=Bted0NJFiBs6MHMZlwHKjq47SsewAApnvnlxthZAXp8=; b=WBPHzrG+SbZBbZlaDs89iKWZZlShG2wxKxZKxts7k3ZTN+zpEx+xYhNyv/583BTUqy y8bsGnE0jxXGDhLSypgcZeNeR3yK0q6DuUEyKq4uMJfmIg6XPLBjStf0hY70E6/MkZbm x6e2byqmqVWVJxpRl5ha6RnHdc5lBVXL9bzO4n0iji2Md8Eyd+p5NccjIer4opY+tvLr efHvTQEmIksSLYHRVkstUQVKq2hUhnZ7FeME1auhcjrUGsOOmRG96qiVOtrPCVS4IhED jHHvEjOhnvRLnDGwoHbpI2rjMJWYfCk1pdfO3zmBkkaJIAregjgkP4EFJ0aXSTMb3JrW Z0LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=O9TXPcuv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id t13-20020a17090aba8d00b002791e648ceasi3591875pjr.112.2023.09.30.05.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 05:51:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=O9TXPcuv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 7A97E80752BD; Sat, 30 Sep 2023 04:55:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234160AbjI3LqF (ORCPT + 99 others); Sat, 30 Sep 2023 07:46:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230465AbjI3LqE (ORCPT ); Sat, 30 Sep 2023 07:46:04 -0400 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41BDBD6 for ; Sat, 30 Sep 2023 04:46:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1696074356; bh=BwM+qiiSjT1rizB6dAsk8vCl4yMw7XPT8jMNJNoi4ZM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=O9TXPcuv1INo2O/LEVGwoMn7GBtYbSLD9JigUWTf/gPPFSAPxzNXXj5nnVm8basaf uRORdbD/5Q75Q3fCrfkzJ+u3C6tS4tNT9wlP45TDKvYIimJYx7TgUG0NNsVcaMbXoY JSDImIPSuIHcseoi98qIyE5XS4FjWvxBs/LJ4UY4YnyLZ4TtD0GrSFSGuxnpLjhLsv KEEbxRjpAj4Rl4+j+UUOcux8+RQEd654mjO9NKni0CNExGZnLOAWovEF6kZBq24hRp MjI5P+ujwAJMV3VcMtFGKBbNb303RvMO0Rfdp8WCHphkIv+26sVyJ7upwgt6lynDPg IVYHvsvU8fLmA== Received: from [IPV6:2606:6d00:100:4000:cacb:9855:de1f:ded2] (unknown [IPv6:2606:6d00:100:4000:cacb:9855:de1f:ded2]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4RyQQX3vp9z1Rh8; Sat, 30 Sep 2023 07:45:56 -0400 (EDT) Message-ID: <0f3cfff3-0df4-3cb7-95cb-ea378517e13b@efficios.com> Date: Sat, 30 Sep 2023 07:45:38 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [RFC PATCH] sched/fair: Bias runqueue selection towards almost idle prev CPU Content-Language: en-US To: Chen Yu Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, Ingo Molnar , Valentin Schneider , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Vincent Guittot , Juri Lelli , Swapnil Sapkal , Aaron Lu , Tim Chen , K Prateek Nayak , "Gautham R . Shenoy" , x86@kernel.org References: <20230929183350.239721-1-mathieu.desnoyers@efficios.com> From: Mathieu Desnoyers In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sat, 30 Sep 2023 04:55:11 -0700 (PDT) On 9/30/23 03:11, Chen Yu wrote: > Hi Mathieu, > > On 2023-09-29 at 14:33:50 -0400, Mathieu Desnoyers wrote: >> Introduce the WAKEUP_BIAS_PREV_IDLE scheduler feature. It biases >> select_task_rq towards the previous CPU if it was almost idle >> (avg_load <= 0.1%). > > Yes, this is a promising direction IMO. One question is that, > can cfs_rq->avg.load_avg be used for percentage comparison? > If I understand correctly, load_avg reflects that more than > 1 tasks could have been running this runqueue, and the > load_avg is the direct proportion to the load_weight of that > cfs_rq. Besides, LOAD_AVG_MAX seems to not be the max value > that load_avg can reach, it is the sum of > 1024 * (y + y^1 + y^2 ... ) > > For example, > taskset -c 1 nice -n -20 stress -c 1 > cat /sys/kernel/debug/sched/debug | grep 'cfs_rq\[1\]' -A 12 | grep "\.load_avg" > .load_avg : 88763 > .load_avg : 1024 > > 88763 is higher than LOAD_AVG_MAX=47742 I would have expected the load_avg to be limited to LOAD_AVG_MAX somehow, but it appears that it does not happen in practice. That being said, if the cutoff is really at 0.1% or 0.2% of the real max, does it really matter ? > Maybe the util_avg can be used for precentage comparison I suppose? [...] > Or > return cpu_util_without(cpu_rq(cpu), p) * 1000 <= capacity_orig_of(cpu) ? Unfortunately using util_avg does not seem to work based on my testing. Even at utilization thresholds at 0.1%, 1% and 10%. Based on comments in fair.c: * CPU utilization is the sum of running time of runnable tasks plus the * recent utilization of currently non-runnable tasks on that CPU. I think we don't want to include currently non-runnable tasks in the statistics we use, because we are trying to figure out if the cpu is a idle-enough target based on the tasks which are currently running, for the purpose of runqueue selection when waking up a task which is considered at that point in time a non-runnable task on that cpu, and which is about to become runnable again. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com