Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2103009yba; Sun, 5 May 2019 22:53:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1dIKK5bXH0mikIB6gg0/t4D62yHW4Gke2uxLD+rKjj3jS9RbX5o7kZCZAvFaHm+ZDx0zR X-Received: by 2002:a63:f147:: with SMTP id o7mr30197430pgk.197.1557121984039; Sun, 05 May 2019 22:53:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557121984; cv=none; d=google.com; s=arc-20160816; b=Sdxf+MS8rQy710cW2Wri/JBR1Z9gAHZXl/Rxni7IDz2wstcpAVtRs+FoN7IwajUGZL rzUw9wuooiPOfMbPiQLWYUAYMb7GZNJXWTUnl0ZJSmuLcCZ52e9ZdheM1VofCGk6knG7 EL1we2GFxTJO7Y59TtpDzzD9tFBXSLNEhXoceCHhLrEUA/2dIVYUNYb364pAIZ6cJ+nG +o5v7vHkBc8W301zs9IeHa5N3Wqt26fzKeYeWsjsELVp5viDmw+yimjowpuEnjbxTCgk eXD/aUjpViLnDOBsV8zCt8Q+rfqclLOYrZJ3QJot+6Q2md0iBNAdSFZhDpRlXgj/UVf4 Xz+g== 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=nzW4H5xPVTIC5QOnW7Ds0BxD/mQUBi0uIl9h1AIThFg=; b=aNmZS1AyvBVMcyxSicV4o9WbRi0B8KOaEmDXM6JOJ1UkLkV3nDaOE4T/C0+QX87QwQ 2+VRTr803JaBj95lU4y/ASMusnWUXDp46fSwPuX3pzNFKWZMxhBI4AoTvFBtgi/HgVVq XrTD4oGIWsiuv3ez10ZPDQE442Fyxv/rEqorcInL5buBiAxVOn9a5/WOsO0yFpwtNm/5 cUB+vX+n4cajbMsTpXQgFPgpJsHdH43LTX3Kclhy7PDJnSJk4yEtbEZ3uA24Xwgd6O7V T6nvstMHvD1pwGXn94lwQbV2Zr7UDMJNXUMNxEsAIIT62a6ser8a4OudanJq1naMsz8q bvAg== 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 g15si3324253pgk.260.2019.05.05.22.52.48; Sun, 05 May 2019 22:53:04 -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 S1726322AbfEFFtW (ORCPT + 99 others); Mon, 6 May 2019 01:49:22 -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 S1725830AbfEFFtG (ORCPT ); Mon, 6 May 2019 01:49:06 -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 138841010; Mon, 06 May 2019 06:49:00 +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 4/6] sched/dl: Improve capacity-aware wakeup Date: Mon, 6 May 2019 06:48:34 +0200 Message-Id: <20190506044836.2914-5-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 Instead of considering the "static CPU bandwidth" allocated to a SCHED_DEADLINE task (ratio between its maximum runtime and reservation period), try to use the remaining runtime and time to scheduling deadline. Signed-off-by: luca abeni --- kernel/sched/cpudeadline.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c index d21f7905b9c1..111dd9ac837b 100644 --- a/kernel/sched/cpudeadline.c +++ b/kernel/sched/cpudeadline.c @@ -114,8 +114,13 @@ static inline int dl_task_fit(const struct sched_dl_entity *dl_se, int cpu, u64 *c) { u64 cap = (arch_scale_cpu_capacity(NULL, cpu) * arch_scale_freq_capacity(cpu)) >> SCHED_CAPACITY_SHIFT; - s64 rel_deadline = dl_se->dl_deadline; - u64 rem_runtime = dl_se->dl_runtime; + s64 rel_deadline = dl_se->deadline - sched_clock_cpu(smp_processor_id()); + u64 rem_runtime = dl_se->runtime; + + if ((rel_deadline < 0) || (rel_deadline * dl_se->dl_runtime < dl_se->dl_deadline * rem_runtime)) { + rel_deadline = dl_se->dl_deadline; + rem_runtime = dl_se->dl_runtime; + } if (c) *c = cap; -- 2.20.1