Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1183538ybh; Thu, 23 Jul 2020 02:32:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5nkr0ZVTIIQ1kqNXJWkVIp4WgD4WTo+2+6Zkogvgb+cXzoRkPDIEsFYwmYJiiYyHB8tKu X-Received: by 2002:a17:906:3bd5:: with SMTP id v21mr3327863ejf.329.1595496771874; Thu, 23 Jul 2020 02:32:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595496771; cv=none; d=google.com; s=arc-20160816; b=d9PSipPbxM01LoW2dO+rje9mBpNEaMFnrMkpmCYkwJoq0nD9r0blEtNrZ3i4tP69iP mDMdmAntFp81NGJICmCPkvX3O1L5yikfDod2opvJznp85Ld5FiY9niGo0Ia1ASg0xVdB 6f3Ev++h4v3ZYMTnFpYVB/f/okmWGNtXlpvtx+lB/C+nGPfQQNXRK4GEqb8ICpeXR6vw XS+9lAR0FeZAqK09d7TDseKupfXTbNEWNtkG8WrFNucsKT/+z3mgl2+QjX62jCUNcZ5N KNTxlMNKyEF4kxBOcJEB3S2bbzs+x7TKWgWMAPwaQ09VAL4Wumd+MWIKdTft37utVW1E w6lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=bTS4iLrk9FqINrghevsiYzIncRFG6yWVx0SoCyRL9Bw=; b=LkkraW77GXhi8pNrh1NKy21Ang/WbsNEKJwJ3tJw2Bx1Qayyssi2U+ZXlPM6QeP+vV 15hQeKlCwripx/F1F7mZyw1EvxO3tJdSV+Y4Guufe02lFZGkqM23QkzEeZLsHadnviq5 fgN3mBrrWE4f2awfvLXopqi9zo8V8bY3Ng2giAcvRt7SiTL+OYDmdYvHltnL8HV7LjW2 UX5tJEhtJ6Nel1JFpnOElkWUuAHyDD8oE3c5DYB+Hrb+LG2orfZtoTnoZOJHP75ayPiN m4d40wCXlInVymyCQ4XyVhi7NDDnSyDAG865NaTlD47he1PnXZPXj9Y7GClnzjj1/Mig 7DDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f1si1566542eje.610.2020.07.23.02.32.28; Thu, 23 Jul 2020 02:32:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728052AbgGWJbo (ORCPT + 99 others); Thu, 23 Jul 2020 05:31:44 -0400 Received: from foss.arm.com ([217.140.110.172]:42600 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726177AbgGWJbo (ORCPT ); Thu, 23 Jul 2020 05:31:44 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 57609D6E; Thu, 23 Jul 2020 02:31:43 -0700 (PDT) Received: from [192.168.178.2] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 34AE13F66F; Thu, 23 Jul 2020 02:31:41 -0700 (PDT) Subject: [SchedulerWakeupLatency] Skip energy aware task placement To: Patrick Bellasi , LKML Cc: Ingo Molnar , "Peter Zijlstra (Intel)" , Vincent Guittot , Juri Lelli , Paul Turner , Ben Segall , Thomas Gleixner , Jonathan Corbet , Dhaval Giani , Josef Bacik , Chris Hyser , Parth Shah , Quentin Perret References: <87v9kv2545.derkling@matbug.com> <87h7wd15v2.derkling@matbug.net> <87imgrlrqi.derkling@matbug.net> <87mu5sqwkt.derkling@matbug.net> <87eer42clt.derkling@matbug.net> <87imfi2qbk.derkling@matbug.net> From: Dietmar Eggemann Message-ID: <2aa4b838-c298-ec7d-08f3-caa50cc87dc2@arm.com> Date: Thu, 23 Jul 2020 11:31:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87imfi2qbk.derkling@matbug.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/06/2020 09:29, Patrick Bellasi wrote: > .:: Scheduler Wakeup Path Requirements Collection Template > ========================================================== > > A) Name: unique one-liner name for the proposed use-case [SchedulerWakeupLatency] Skip energy aware task placement > B) Target behaviour: one paragraph to describe the wakeup path issue The search for the most energy-efficient CPU over the Performance Domains (PDs) by consulting the Energy Model (EM), i.e. the estimation on how much energy a PD consumes if the task migrates to one of its CPUs, adds a certain amount of latency to task placement. For some tasks this extra latency could be too high. A good example here are the Android display pipeline tasks, UIThread and RenderThread. They have to be placed on idle CPUs with a faster wakeup mechanism than the energy aware wakeup path (A) to guarantee the smallest amount of dropped or delayed frames (a.k.a. jank). In Linux kernel mainline there is currently no mechanism for latency sensitive tasks to allow that the energy aware wakeup path (A) is skipped and the fast path (B) taken instead. > C) Existing control paths: reference to code paths to justify B) select_task_rq_fair() { ... if (wakeup) if (asym_cpucapacity && EM && schedutil) new_cpu = find_energy_efficient_cpu(); <- (A) if (new_cpu >= 0) return new_cpu; ... if (unlikely(sd)) /* slow path */ else if (sd_flag & wakeup) /* fast path */ new_cpu = select_idle_sibling() { if (asym_cpucapacity) new_cpu = select_idle_capacity(); <- (B) if (new_cpu >= 0) return new_cpu; } ... return new_cpu; } > D) Desired behaviour: one paragraph to describe the desired update A mechanism for a task to skip the energy aware wakeup (A) and fallback into the fast path (B). > E) Existing knobs (if any): reference to whatever existing tunable There are no existing ways to control this behaviour in Linux kernel mainline. There is the concept of 'prefer idle' in Android which is tightly coupled with the proprietary cgroup controller schedtune. > F) Existing knobs (if any): one paragraph description of the limitations Schedtune will be replaced by mainline uclamp in upcoming Android releases. There is no per-task 'prefer idle' interface. > G) Proportionality Analysis: check the nature of the target behavior The use case requires that a task either cares about latency or not. > H) Range Analysis: identify meaningful ranges The knob can be defined as latency sensitive (i.e. prefer an idle CPU) or as not latency sensitive. Mapping Analysis: If required by other use-cases, the binary range requirement can easily be covered by a wider, more fine grained latency sensitive range. > I) System-Wide tuning: which knobs are required No system-wide tuning required. > J) Per-Task tuning: which knobs are required The proposal is a per-task flag, indicating whether the task is latency sensitive or not. > K) Task-Group tuning: which knobs are required Currently Android uses the 'prefer idle' mechanism only on task-groups and not on individual tasks. Therefore a per task-group implementation would be required. The implementation should respect the cgroup resource distribution models [1], [2]. > .:: References > ============== [1] LWN: The many faces of "latency nice" https://lwn.net/Articles/820659 [2] Control Group v2: Resource Distribution Models https://www.kernel.org/doc/Documentation/admin-guide/cgroup-v2.rst