Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755637AbcKJM1O (ORCPT ); Thu, 10 Nov 2016 07:27:14 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35078 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755283AbcKJM1M (ORCPT ); Thu, 10 Nov 2016 07:27:12 -0500 Date: Thu, 10 Nov 2016 13:27:05 +0100 From: luca abeni To: Peter Zijlstra Cc: Ingo Molnar , Thomas Gleixner , Juri Lelli , Steven Rostedt , Claudio Scordino , Tommaso Cucinotta , Daniel Bistrot de Oliveira , Henrik Austad , linux-kernel@vger.kernel.org Subject: Re: [RFD] sched/deadline: Support single CPU affinity Message-ID: <20161110132705.46340cd4@sweethome> In-Reply-To: <20161110105918.GT3142@twins.programming.kicks-ass.net> References: <20161110080807.GD11311@worktop.programming.kicks-ass.net> <20161110100602.2781af72@sweethome> <20161110105918.GT3142@twins.programming.kicks-ass.net> Organization: university of trento X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3649 Lines: 89 Hi Peter, On Thu, 10 Nov 2016 11:59:18 +0100 Peter Zijlstra wrote: [...] > > > MIXED CRITICALITY SCHEDULING > > > > > > Since we want to provide better guarantees for single CPU affine > > > tasks than the G-EDF scheduler provides for the single CPU tasks, > > > we need to somehow alter the scheduling algorithm. > > > > > > The trivial layered EDF/G-EDF approach is obviously flawed in > > > that it will result in many unnecessary deadline misses. The > > > trivial example is having a single CPU task with a deadline after > > > a runnable global task. By always running single CPU tasks over > > > global tasks we can make the global task miss its deadline even > > > though we could easily have ran both within the alloted time. > > > Ok; the layered approach clearly causes some unneeded deadline > > misses on global tasks... But those tasks risk to miss deadlines > > anyway (with the corrent scheduler, they are guaranteed to have a > > limited tardiness, not to respect all of the deadlines). I think > > this is related to the question about which guarantees are provided > > to the global tasks. > > Right, so I wanted to limit the impact. Basically, given a stronger > admission test for the GEDF scheduler that would guarantee deadlines, > I would like the new scheduling function to still guarantee all > deadlines. Ok; this is interesting... I do not know if it is possible, but it is definitly something interesting to look at. > > > Therefore we must use a more complicated scheme. By adding a > > > second measure present in the sporadic task model to the > > > scheduling function we can try and distinguish between the > > > constraints of handling the two cases in a single scheduler. > > > > > > We define the time to fail as: > > > > > > ttf(t) := t_d - t_b; where > > > > > > t_d is t's absolute deadline > > > t_b is t's remaining budget > > > Ok; I think this is similar to what is called "pseudo-deadline" in > > some papers. > > If I understand well, it is equal to the current time + the task > > "laxity" (or slack time). So, scheduling the task with the smaller > > ttf is equivalent to the "least laxity first" (LLF) algorithm. > > Giving precedence to tasks with 0 laxity is a technique that is > > often used to improve the schedulability on multi-processor > > systems. > > Right, similar to LLF. Initially I was using the term laxity here, but > Hendrik convinced me that this is called time-to-fail. I'll let him > explain :-) Well, if I understand well "time-to-fail" is equal to "laxity + current time"... So, they are two different quantities but the final scheduling algorithm is the same (and using ttf simplifies the implementation a lot :). > But yes, a pure TTF based scheduler should be equivalent to LLF which > itself is fairly similar to EDF in that its optimal for UP etc.. (I > think). Right > > I _suspect_ that the migration rules must also be changed (when a > > task migrates from a runqueue, it currently selects as a target the > > runqueue having the largest earliest deadline... Maybe it should > > also consider the presence of rq-local tasks - or the LLF-ordered > > heap - on the target?) > > Quite possible, I didn't think about that. > > > Did you find this scheduling strategy on some paper? Otherwise, I > > think we need to develop some theoretical analysis for it... (which > > is of course another interesting thing! :) > > No, I cooked this up myself. There might of course still be a paper on > this, but if so, I'm blissfully unaware. Ok; I'll try to have a look at the theoretical analysis. Thanks, Luca