Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Sun, 11 Mar 2001 20:26:44 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Sun, 11 Mar 2001 20:26:34 -0500 Received: from linuxcare.com.au ([203.29.91.49]:36612 "EHLO front.linuxcare.com.au") by vger.kernel.org with ESMTP id ; Sun, 11 Mar 2001 20:26:22 -0500 From: Anton Blanchard Date: Mon, 12 Mar 2001 12:24:47 +1100 To: Davide Libenzi Cc: linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: sys_sched_yield fast path Message-ID: <20010312122447.A7350@linuxcare.com> In-Reply-To: <20010312005448.A5439@linuxcare.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.15i In-Reply-To: ; from davidel@xmailserver.org on Mon, Mar 12, 2001 at 01:10:30AM +0100 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Hi, > 2.4.x has changed the scheduler behaviour so that the task that call > sched_yield() is not rescheduled by the incoming schedule(). A flag is > set ( under certain conditions in SMP ) and the goodness() calculation > assign the lower value to the exiting task ( this flag is cleared in > schedule_tail() ). The behaviour I am talking about is when there is a heavily contended spinlock, and more than one task is trying to obtain it. Since SCHED_YIELD only changes the goodness when we are trying to reschedule the task we can bounce between two or more tasks doing sched_yield() for a while before finally running the task that has the spinlock. Of course with short lived spinlocks you should rarely get the case where a task grabs a spinlock just before its timeslice is up, so maybe the answer is just to spin a few times on sched_yield() then back off to nanosleep() like pthreads does. Anton - 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/