Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2712050rdg; Mon, 16 Oct 2023 12:24:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHELnXfuz/bxRxHnEOH2jg5+pjh1wdZjcp4TreF9W55WzLaF3SCbJow/6bvCKXl3qMi4lwY X-Received: by 2002:a05:6870:41d3:b0:1e9:64f1:9c30 with SMTP id z19-20020a05687041d300b001e964f19c30mr84197oac.18.1697484296333; Mon, 16 Oct 2023 12:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697484296; cv=none; d=google.com; s=arc-20160816; b=z72ybwUC4TNVrm/YL5ZuydFkp7NNqfMyN2evMxFuARSzsldZpnVejQ/qmGu+AhMmqJ RtVNp8pHEZR/Cse+FWdqh+Jfad79eOS1BJVxBsyvZthm3MSdSMuYI3n7PS6JGjfcUCWE I2yeQsBrPeE73U52sCdTYRkXaxwBKxyTtA7MrWEEWMA96tPRvyHtyNyI4yRMzOJQ6QLe datD8fOnvfNjb4wRZKpogJX6uYm3aZz6hACvhm2TiBBeriWyNcxwDrCw+4pj6035/o1t BZ0U3PH8DHP+P3ujxq8csa0MqFVhrWrWhwbFO9AuPyWr6ffYii3jszyVlKo7zHea8ssF PatA== 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=kgtAWMOLtOZhEitOAzJTJ5pSnGtLP9h9560+6zJAfv4=; fh=Bted0NJFiBs6MHMZlwHKjq47SsewAApnvnlxthZAXp8=; b=Y1zA6xywvxHEHuPapOPhSu7jb4SLDqsD+qv0qJwiwpmmdyANtr87c7Dr9HX8Z8dylu j0wUoLY4mMaQJljtAdJGG6aLOAN9K8L7IQigM6HR/EhXlpPe0iX4Vfj4HkTTmz0q0pLi Il5tuC1SIkJZFV34nJLS7i1FCdEiR3WW2YeP0sCWP2gPmRj42yPhOSjO2j1KMsIeN5Ab U7m+oZBdc4FA99FnHWE3l/DkCs0ZTXk8AYZvJSH8bL9w/ZSGLN5Gqkdd9CXcnxINrArI s8vpmas3YA27IK6c6NmPtOEyedaOnv7aXiIFrAsH1NOyQf6Igf3yw/otJZvezZqSEk2X HGMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=J9TmQk3i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id e4-20020a636904000000b005b3e6867a01si4852381pgc.427.2023.10.16.12.24.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 12:24:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=J9TmQk3i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 8510580A9DDA; Mon, 16 Oct 2023 12:24:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233267AbjJPTYo (ORCPT + 99 others); Mon, 16 Oct 2023 15:24:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232582AbjJPTYn (ORCPT ); Mon, 16 Oct 2023 15:24:43 -0400 Received: from smtpout.efficios.com (unknown [IPv6:2607:5300:203:b2ee::31e5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E33D2A2 for ; Mon, 16 Oct 2023 12:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1697484277; bh=Z3f3fZEY91HAlKBHOM6V0oi/muY0h7esgdTKiJIgvpg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=J9TmQk3iaQjuKga7kEKkWtVs2rdFj3pYozZj6qLXpOCuT4+p6gf922wTCrPIS3EYk OMW/ci2En4TpwClVnM0LUNNmqOipoi4Lb81kT6qCS0jQSY9dHAEY0kKdTeqNXNUQ0r jgQDAGvJo9ziM9V0+6GyMX1B81eekV3kYPVgiGXs1UI4wVuRfi6qyZewxlYXdP6Qb0 ZmmzJ5YdKJaCm8dRGTUK94ioF4MHtHAWgec9PJynWJQouSx3vgLgFOCcqAS90gMxYd 7azbLufJjsvNR+FUemGH3GENHJmOFB9MtqRxboqEpuV/H3guyoVjUYsCuUtvHCsu86 ZlgWR12hRR+SQ== Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4S8RrP3gk7z1XRr; Mon, 16 Oct 2023 15:24:37 -0400 (EDT) Message-ID: Date: Mon, 16 Oct 2023 15:24:45 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH] sched/fair: Introduce WAKEUP_BIAS_PREV_IDLE to reduce migrations 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: <20231012203626.1298944-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=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 fry.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 (fry.vger.email [0.0.0.0]); Mon, 16 Oct 2023 12:24:53 -0700 (PDT) On 2023-10-15 11:44, Chen Yu wrote: > On 2023-10-12 at 16:36:26 -0400, Mathieu Desnoyers wrote: >> Introduce the WAKEUP_BIAS_PREV_IDLE scheduler feature to reduce the >> task migration rate. >> >> For scenarios where the system is under-utilized (CPUs are partly idle), >> eliminate frequent task migrations from almost idle CPU to completely >> idle CPUs by introducing a bias towards the previous CPU if it is idle >> or almost idle in select_idle_sibling(). Use 1% of the CPU capacity >> of the previously used CPU as CPU utilization "almost idle" cutoff. >> >> + >> +/* >> + * A runqueue is considered almost idle if: >> + * >> + * cpu_util_without(cpu, p) / 1024 <= 1% * capacity_of(cpu) > > util_avg is in the range [0:1024], thus cpu_util_without(cpu, p) / 1024 > is <= 1, and 1% * cap is 10, so 1 <= 10 is always true. > I suppose you want to compare: > (cpu_util_without(cpu, p) / capacity_orig_of(cpu)) <= 1% -> > cpu_util_without(cpu, p) * 100 <= capacity_orig_of(cpu) ? Good point! Now that I have fixed this, I come back to a situation where: - load_avg works, probably because it multiplies by the weight, and therefore when there are few tasks on the runqueue it reflects the fact that the runqueue is almost idle. Even though it happens to work, it does not appear to be an elegant solution. - util_avg and runnable_avg do not work. Probably because they take into account both running/runnable and recently blocked tasks, so they cannot be used to provide a clear picture of the very-short-term idleness status for the purpose of selecting a prev rq. I wonder if there are any rq stats I can use which do not include recently blocked tasks ? Thanks, Mathieu > > thanks, > Chenyu > > -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com