Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp444874ybb; Wed, 8 Apr 2020 03:07:36 -0700 (PDT) X-Google-Smtp-Source: APiQypJS1t6E0g1ktF8rr7pTFwTTYFpdbSZ779nY2K+z7cUo9tyT4zHp40gt+V3ZV0BLSSGMOCqy X-Received: by 2002:a4a:d21e:: with SMTP id c30mr5418100oos.0.1586340456370; Wed, 08 Apr 2020 03:07:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586340456; cv=none; d=google.com; s=arc-20160816; b=nvT3JbMb6U598pxPQTBLEBfB9/7tqERsX+4r4fH+OQXf1CE9v9v11mpAOvTpxQAeyI gU68z2m62NMzdQrrY7rY9Cypv8ab2wF8CjsvxgXsCY5B6VbHclH3Mg4ZMa6FDg7g/AX4 VPoRfkxeYGfftRs95uaiUKysMoI9AbQfO1AYcgQqGcnaACxDeqyu+a5oCL9mZEcXpNab I0bvLpiM/QVNPFpPlYD/5nOIQASsugiE0VKUPQiBTfXRW2D4fNoSYnb+IAlp+dcVqpRY A79gssQepYxU7krFfEhyGHZz0SGsW//wQiGq2l8159bNYPK1Ghn5HHQtNKoDGHypZAnX rQ+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=x3g1H2EgFUKPOhxW17/A3g7K1M2EcQOd1pSeRpI1/dA=; b=tn967zZcbUSqkJVlcGEbEJPSoTejaH1tmdYiTjjoxUI712raBR7pBauz22wofSGpev zGNhBbhAH/Y1IB9C3OL0s+g31ku92BkBlo3ys0GK3diaQLjcO+Y1GSFfSdFpq/drju2K zek6KnyX8LPrRy4HtXKwHtj52DzGWC3pkg8uAWxZTPJK1m+2LKCL9WEX5J+xYjis86Id pzN9sUYncJnmXKAbOUoY3MMT6WSxU+7QZhuBXpefdktlACiDNuKR9mXj2i3xRvztWbm+ iRg97Wna/bKVotFO0gyFyI8w7R8hESKcab05Mz8jH79o5HE7UKbjLHOInBecnZb26O4s CIPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r15si2336857otc.316.2020.04.08.03.07.21; Wed, 08 Apr 2020 03:07:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727945AbgDHJu0 (ORCPT + 99 others); Wed, 8 Apr 2020 05:50:26 -0400 Received: from foss.arm.com ([217.140.110.172]:36266 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbgDHJu0 (ORCPT ); Wed, 8 Apr 2020 05:50:26 -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 700BA31B; Wed, 8 Apr 2020 02:50:25 -0700 (PDT) Received: from macbook.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8F8AE3F73D; Wed, 8 Apr 2020 02:50:22 -0700 (PDT) From: Dietmar Eggemann To: Ingo Molnar , Peter Zijlstra , Juri Lelli Cc: Vincent Guittot , Steven Rostedt , Luca Abeni , Daniel Bristot de Oliveira , Wei Wang , Quentin Perret , Alessio Balsini , Pavan Kondeti , Patrick Bellasi , Morten Rasmussen , Valentin Schneider , Qais Yousef , linux-kernel@vger.kernel.org Subject: [PATCH 0/4] Capacity awareness for SCHED_DEADLINE Date: Wed, 8 Apr 2020 11:50:08 +0200 Message-Id: <20200408095012.3819-1-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The SCHED_DEADLINE (DL) admission control does not work correctly on heterogeneous (asymmetric CPU capacity) systems such as Arm big.LITTLE or DynamIQ. Let's fix this by explicitly considering CPU capacity in DL admission control and task migration. The DL sched class now attempts to avoid missing task deadlines due to smaller CPU (CPU capacity < 1024) not being capable enough to finish a task in time. It does so by trying to place a task so that its CPU capacity scaled deadline is not smaller than its runtime. Changes RFC [1] -> v1: Only use static values for CPU bandwidth (sched_dl_entity::dl_runtime, ::dl_deadline) and CPU capacity (arch_scale_cpu_capacity()) to fix DL admission control. Dynamic values for CPU bandwidth (sched_dl_entity::runtime, ::deadline) and CPU capacity (capacity_of()) are considered to be more related to energy trade-off calculations which could be later introduced using the Energy Model. Since the design of the DL and RT sched classes are very similar, the implementation follows the overall design of RT capacity awareness (commit 804d402fb6f6 ("sched/rt: Make RT capacity-aware")). Per-patch changes: (1) Store CPU capacity sum in the root domain during build_sched_domains() [patch 1/4] (2) Adjust to RT capacity awareness design [patch 3/4] (3) Remove CPU capacity aware placement in switched_to_dl() (dl_migrate callback) [RFC patch 3/6] Balance callbacks (push, pull) run only in schedule_tail() __schedule(), rt_mutex_setprio() or __sched_setscheduler(). DL throttling leads to a call to __dequeue_task_dl() which is not a full task dequeue. The task is still enqueued and only removed from the rq. So a queue_balance_callback() call in update_curr_dl()-> __dequeue_task_dl() will not be followed by a balance_callback() call in one of the 4 functions mentioned above. (4) Remove 'dynamic CPU bandwidth' consideration and only support 'static CPU bandwidth' (ratio between sched_dl_entity::dl_runtime and ::dl_deadline) [RFC patch 4/6] (5) Remove modification to migration logic which tried to schedule small tasks on LITTLE CPUs [RFC patch 6/6] [1] https://lore.kernel.org/r/20190506044836.2914-1-luca.abeni@santannapisa.it The following rt-app testcase tailored to Arm64 Hikey960: root@h960:~# cat /sys/devices/system/cpu/cpu*/cpu_capacity 462 462 462 462 1024 1024 1024 1024 shows the expected behavior. According to the following condition in dl_task_fits_capacity() cap_scale(dl_deadline, arch_scale_cpu_capacity(cpu)) >= dl_runtime thread0-[0-3] are placed on a big CPUs whereas thread1-[0-3] run on a LITTLE CPU respectively. ... "tasks" : { "thread0" : { "policy" : "SCHED_DEADLINE", "instance" : 4, "timer" : { "ref" : "unique0", "period" : 16000, "mode" : "absolute" }, "run" : 10000, "dl-runtime" : 11000, "dl-period" : 16000, "dl-deadline" : 16000 }, "thread1" : { "policy" : "SCHED_DEADLINE", "instance" : 4, "delay" : 1000, "timer" : { "ref" : "unique1", "period" : 16000, "mode" : "absolute" }, "run" : 5500, "dl-runtime" : 6500 "dl-period" : 16000, "dl-deadline" : 16000 } ... Tests were run with Performance CPUfreq governor so that the Schedutil CPUfreq governor DL threads (sugov:[0,4]), necessary on a slow-switching platform like Hikey960, do not interfere with the rt-app test tasks. Using Schedutil would require to lower the number of tasks to 3 instances each. Dietmar Eggemann (1): sched/topology: Store root domain CPU capacity sum Luca Abeni (3): sched/deadline: Improve admission control for asymmetric CPU capacities sched/deadline: Make DL capacity-aware sched/deadline: Implement fallback mechanism for !fit case kernel/sched/cpudeadline.c | 23 +++++++++++++++++++++ kernel/sched/deadline.c | 41 +++++++++++++++++++++++--------------- kernel/sched/sched.h | 33 ++++++++++++++++++++++++++++-- kernel/sched/topology.c | 14 +++++++++---- 4 files changed, 89 insertions(+), 22 deletions(-) -- 2.17.1