Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933902AbbHLJLE (ORCPT ); Wed, 12 Aug 2015 05:11:04 -0400 Received: from smtprelay06.ispgateway.de ([80.67.31.95]:50295 "EHLO smtprelay06.ispgateway.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933802AbbHLJK7 (ORCPT ); Wed, 12 Aug 2015 05:10:59 -0400 X-Greylist: delayed 130987 seconds by postgrey-1.27 at vger.kernel.org; Wed, 12 Aug 2015 05:10:59 EDT Message-ID: <55CB0D9E.6020700@riesch.at> Date: Wed, 12 Aug 2015 11:10:54 +0200 From: Michael Riesch User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: Juri Lelli CC: "linux-kernel@vger.kernel.org" , "juri.lelli@gmail.com" Subject: Re: Question about SCHED_DEADLINE and sched_yield() usage References: <55C90DE7.1000400@riesch.at> <55C9D32A.4030506@riesch.at> <55C9E29B.1050203@arm.com> In-Reply-To: <55C9E29B.1050203@arm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Df-Sender: bWljaGFlbEByaWVzY2guYXQ= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2067 Lines: 44 Hi Juri, On 08/11/2015 01:55 PM, Juri Lelli wrote: > As you are running a 3.14 kernel, you probably missed this fix > 5bfd126e80dc "sched/deadline: Fix sched_yield() behavior". Can > you please check? I stumbled over this commit but somehow managed to ignore it. Anyway, I upgraded to 4.1, now the application shows the expected behavior. >> As far as I understand, I have to call sched_yield() if the the >> execution time of one loop iteration is either not constant or unknown >> (both cases being very likely), because if I do not, a new loop >> iteration could be started if the time budget is not empty. >> > > It depends. The sched_yield() semantic for SCHED_DEADLINE might > be used to implement some sort of reclaiming mechanism (not > there yet) where you inform the scheduler that you are not going > to use the remaining runtime in this period; and the scheduler > could recycle this spare runtime for other tasks that are running > short of it. > > However, I'd say that in your case you can also live without it. > SCHED_DEADLINE can handle sporadic tasks, it depends on how you > implement your userspace loop I guess. If you just check the active > flag, and this flag is always set, you are right that you may > end up executing back to back, though; in which case it seems that yield > semantic could do the trick. Since samples are generated and the resulting curve looks like it was sampled with a constant frequency, I think that sched_yield() is to be used in this context. Before I used sched_yield(), I had to use some sleep statements, which made the sample frequency not deterministic and filled the CPU up. Now it seems to work pretty well. Congrats on the deadline scheduler - it is a great way to introduce some real-time capability - and thank you for your help. Best regards, Michael -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/