Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2102488yba; Sun, 5 May 2019 22:52:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqw8lYhUpCyXKcHS4AqW5N869G6EoqAq2XOWaozc4wZH7SQTzdjzfE2y0KnFZQkQxOAv9PBU X-Received: by 2002:a17:902:b617:: with SMTP id b23mr28811017pls.73.1557121932556; Sun, 05 May 2019 22:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557121932; cv=none; d=google.com; s=arc-20160816; b=cWK4t3rHGDXjmWg96vw8/eWr5WyMEyyja8b1DAe3CHhIriYVAdM8gtdK7IHeqi+Oqf 9B5f5rN5JaHWMerDTYuF9Fj0whtinBqVKXZhxiDvKPhnosARGn5UuekmCw9gmoM0IFcD kv68kB7yTeW1sdT9FMSHTZUtIZOsjbtvTJcwdHL2yohwclBPgfkXw8eXuLczO43VzA7g woVr1otfk9zfRdGPOqVU278u7zatc/UZiaJlHpnMaxg+HxIu8OiZmJlx8rJCBXX8v7YV 7OmRnOOZ3BSlOzMWI4V9y6AOgybjfj4Y345jlsmHCLQ6VjZbUd7mfeo1w7uHj8Ve3rCF H/QA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5XE0nT2bZMNXa6JMlWbtMLjTnMw3BfPdEz9an6dBKvo=; b=0ZU9VMSbptIZekdaxMrqb759aOvpx1VQY8rLm4Y1ZsmvTp/QI0N/Q7U0BbUCzb2Itx GlEpvzVNChYnWSAKCmGapaHEfd3GJTWofs8nTcBVw9nzQ1XFse6wt5OWcCVGkPw4QaI8 JF5VkXyQP2W5uVLvJSmVAFTTRWcymPFcodCBRrw2xCUSZGefkplMTxkr6th7NLhAi/aF S9nl10yLUAYAvdzqlsXgNS5vH/c5H1XszBkW/ZQnBZHBpXAiy/OmuINCkhAYJYLdLrWc xEnMy0YxMEF6QwX8B0J78wUfA+RA8B4NMTs7Tc0wPzlSKDsSj7nXkjATnXZYPBJ2nGKt 9uYA== 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 x6si13181980plv.97.2019.05.05.22.51.24; Sun, 05 May 2019 22:52:12 -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 S1726270AbfEFFtL (ORCPT + 99 others); Mon, 6 May 2019 01:49:11 -0400 Received: from ms01.santannapisa.it ([193.205.80.98]:57922 "EHLO mail.santannapisa.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726218AbfEFFtI (ORCPT ); Mon, 6 May 2019 01:49:08 -0400 X-Greylist: delayed 3600 seconds by postgrey-1.27 at vger.kernel.org; Mon, 06 May 2019 01:48:55 EDT Received: from [151.41.47.232] (account l.abeni@santannapisa.it HELO sweethome.home-life.hub) by santannapisa.it (CommuniGate Pro SMTP 6.1.11) with ESMTPSA id 138841011; Mon, 06 May 2019 06:49:01 +0200 From: Luca Abeni To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , "Rafael J . Wysocki" , Ingo Molnar , Peter Zijlstra , Vincent Guittot , "Paul E . McKenney" , Joel Fernandes , Quentin Perret , Luc Van Oostenryck , Morten Rasmussen , Juri Lelli , Daniel Bristot de Oliveira , Patrick Bellasi , Tommaso Cucinotta , luca abeni Subject: [RFC PATCH 5/6] sched/dl: If the task does not fit anywhere, select the fastest core Date: Mon, 6 May 2019 06:48:35 +0200 Message-Id: <20190506044836.2914-6-luca.abeni@santannapisa.it> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190506044836.2914-1-luca.abeni@santannapisa.it> References: <20190506044836.2914-1-luca.abeni@santannapisa.it> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: luca abeni When a task has a remaining runtime that cannot be served within the scheduling deadline by anyone of the idle cores, the task is doomed to miss its deadline (this can happen, because the admission control only guarantees a bounded tardiness, not the hard respect of all deadlines). In this case, try to select the fastest idle core, to minimize the tardiness. Signed-off-by: luca abeni --- kernel/sched/cpudeadline.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c index 111dd9ac837b..2a4ac7b529b7 100644 --- a/kernel/sched/cpudeadline.c +++ b/kernel/sched/cpudeadline.c @@ -123,7 +123,7 @@ static inline int dl_task_fit(const struct sched_dl_entity *dl_se, } if (c) - *c = cap; + *c = arch_scale_cpu_capacity(NULL, cpu); if ((rel_deadline * cap) >> SCHED_CAPACITY_SHIFT < rem_runtime) return 0; @@ -146,14 +146,22 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p, if (later_mask && cpumask_and(later_mask, cp->free_cpus, &p->cpus_allowed)) { - int cpu; + int cpu, max_cpu = -1; + u64 max_cap = 0; for_each_cpu(cpu, later_mask) { u64 cap; if (!dl_task_fit(&p->dl, cpu, &cap)) cpumask_clear_cpu(cpu, later_mask); + + if (cap > max_cap) { + max_cap = cap; + max_cpu = cpu; + } } + if (cpumask_empty(later_mask) && max_cap) + cpumask_set_cpu(max_cpu, later_mask); if (!cpumask_empty(later_mask)) return 1; -- 2.20.1