From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757966Ab1EYOOB (ORCPT ); Wed, 25 May 2011 10:14:01 -0400 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.124]:52919 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756460Ab1EYOOA (ORCPT ); Wed, 25 May 2011 10:14:00 -0400 X-Authority-Analysis: v=1.1 cv=u/eXSd3k4P+OuNmbl5aZU3ellt6eTxbOnGssQLT4hSY= c=1 sm=0 a=2hPWuqIl968A:10 a=5SG0PmZfjMsA:10 a=Q9fys5e9bTEA:10 a=OPBmh+XkhLl+Enan7BmTLg==:17 a=fz7pyEXQYRP1zBkFiHcA:9 a=PUjeQqilurYA:10 a=OPBmh+XkhLl+Enan7BmTLg==:117 X-Cloudmark-Score: 0 X-Originating-IP: 67.242.120.143 Subject: Re: [PATCH] sched: remove starvation in check_preempt_equal_prio() From: Steven Rostedt To: Hillf Danton Cc: Peter Zijlstra , LKML , Ingo Molnar , Mike Galbraith , Yong Zhang In-Reply-To: References: <1306244836.2497.60.camel@laptop> <1306247058.1465.66.camel@gandalf.stny.rr.com> <1306248401.1465.69.camel@gandalf.stny.rr.com> Content-Type: text/plain; charset="ISO-8859-15" Date: Wed, 25 May 2011 10:13:58 -0400 Message-ID: <1306332838.1465.99.camel@gandalf.stny.rr.com> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2011-05-25 at 22:00 +0800, Hillf Danton wrote: > > > > Yes, that is the definition of FIFO (First In First Out). The tasks that > > get to the CPU first run till they voluntarily schedule away, or are > > preempted by an even high priority task. Tasks of the same priority must > > wait till the previous task has finished. > > > > Then I try to fix the violation of FIFO, my thought is like below: > > --- > Subject: [PATCH] sched: fix the violation of SCHED_FIFO in > check_preempt_equal_prio() > > Starvation of the same priority tasks is a perfectly valid situation for > SCHED_FIFO. > > If task p is currently running and is a FIFO task, you do not push it > off for another task of same prio. > Yes, that is the definition of FIFO (First In First Out). The tasks that > get to the CPU first run till they voluntarily schedule away, or are > preempted by an even high priority task. Tasks of the same priority must > wait till the previous task has finished. > No, no, no! I'm sorry if you misunderstood me. When I said 'finished', I did not mean that it was truly finished and the process has exited. I simply meant that finished meant that it scheduled away. Done for the time being. Thus, if a task is running of one priority, another task of same priority will *not* preempt it. If that task schedules for whatever reason, the next task of same priority will then run, and the first one will now have to wait for it to schedule away. That is FIFO. Now we do break this semantic a bit for SMP. If the current task that is running can be migrated to another CPU, and the one that wakes up is of same priority but is pinned to this CPU. If we can migrate the running task to another CPU (another CPU has a lower prio process running), then we will migrate that task to let the woken task run. But this is not really preempting the running task, it is more "moving" it. But there's no real guarantees to what RT tasks do on SMP, so we are fine. -- Steve