Re: sys_sched_yield fast path

2001-03-11 Thread Anton Blanchard
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 >

Re: sys_sched_yield fast path

2001-03-11 Thread Davide Libenzi
On 11-Mar-2001 Dave Zarzycki wrote: > On Mon, 12 Mar 2001, Anton Blanchard wrote: > >> Perhaps we need something like sched_yield that takes off some of >> tsk->counter so the task with the spinlock will run earlier. > > Personally speaking, I wish sched_yield() API was like so: > > int

Re: sys_sched_yield fast path

2001-03-11 Thread Davide Libenzi
On 11-Mar-2001 Anton Blanchard wrote: > >> This is the linux thread spinlock acquire : >> >> >> static void __pthread_acquire(int * spinlock) >> { >> int cnt = 0; >> struct timespec tm; >> >> while (testandset(spinlock)) { >> if (cnt < MAX_SPIN_COUNT) { >> sched_yield(); >>

Re: sys_sched_yield fast path

2001-03-11 Thread Davide Libenzi
On 11-Mar-2001 Anton Blanchard wrote: > >> This is the linux thread spinlock acquire : >> >> >> static void __pthread_acquire(int * spinlock) >> { >> int cnt = 0; >> struct timespec tm; >> >> while (testandset(spinlock)) { >> if (cnt < MAX_SPIN_COUNT) { >> sched_yield(); >>

Re: sys_sched_yield fast path

2001-03-11 Thread Dave Zarzycki
On Mon, 12 Mar 2001, Anton Blanchard wrote: > Perhaps we need something like sched_yield that takes off some of > tsk->counter so the task with the spinlock will run earlier. Personally speaking, I wish sched_yield() API was like so: int sched_yield(pid_t pid); The pid argument would be

Re: sys_sched_yield fast path

2001-03-11 Thread Anton Blanchard
> This is the linux thread spinlock acquire : > > > static void __pthread_acquire(int * spinlock) > { > int cnt = 0; > struct timespec tm; > > while (testandset(spinlock)) { > if (cnt < MAX_SPIN_COUNT) { > sched_yield(); > cnt++; > } else { > tm.tv_sec = 0; >

Re: sys_sched_yield fast path

2001-03-11 Thread Davide Libenzi
On 10-Mar-2001 Andi Kleen wrote: > Davide Libenzi <[EMAIL PROTECTED]> writes: > > >> Probably the rate at which is called sys_sched_yield() is not so high to let >> the performance improvement to be measurable. > > LinuxThreads mutexes call sched_yield() when a lock is locked, so when you >

Re: sys_sched_yield fast path

2001-03-11 Thread Davide Libenzi
On 10-Mar-2001 Andi Kleen wrote: Davide Libenzi [EMAIL PROTECTED] writes: Probably the rate at which is called sys_sched_yield() is not so high to let the performance improvement to be measurable. LinuxThreads mutexes call sched_yield() when a lock is locked, so when you have a

Re: sys_sched_yield fast path

2001-03-11 Thread Anton Blanchard
This is the linux thread spinlock acquire : static void __pthread_acquire(int * spinlock) { int cnt = 0; struct timespec tm; while (testandset(spinlock)) { if (cnt MAX_SPIN_COUNT) { sched_yield(); cnt++; } else { tm.tv_sec = 0; tm.tv_nsec

Re: sys_sched_yield fast path

2001-03-11 Thread Dave Zarzycki
On Mon, 12 Mar 2001, Anton Blanchard wrote: Perhaps we need something like sched_yield that takes off some of tsk-counter so the task with the spinlock will run earlier. Personally speaking, I wish sched_yield() API was like so: int sched_yield(pid_t pid); The pid argument would be

Re: sys_sched_yield fast path

2001-03-11 Thread Davide Libenzi
On 11-Mar-2001 Anton Blanchard wrote: This is the linux thread spinlock acquire : static void __pthread_acquire(int * spinlock) { int cnt = 0; struct timespec tm; while (testandset(spinlock)) { if (cnt MAX_SPIN_COUNT) { sched_yield(); cnt++; } else {

Re: sys_sched_yield fast path

2001-03-11 Thread Davide Libenzi
On 11-Mar-2001 Anton Blanchard wrote: This is the linux thread spinlock acquire : static void __pthread_acquire(int * spinlock) { int cnt = 0; struct timespec tm; while (testandset(spinlock)) { if (cnt MAX_SPIN_COUNT) { sched_yield(); cnt++; } else {

Re: sys_sched_yield fast path

2001-03-11 Thread Davide Libenzi
On 11-Mar-2001 Dave Zarzycki wrote: On Mon, 12 Mar 2001, Anton Blanchard wrote: Perhaps we need something like sched_yield that takes off some of tsk-counter so the task with the spinlock will run earlier. Personally speaking, I wish sched_yield() API was like so: int

Re: sys_sched_yield fast path

2001-03-11 Thread Anton Blanchard
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

Re: sys_sched_yield fast path

2001-03-10 Thread Andi Kleen
Davide Libenzi <[EMAIL PROTECTED]> writes: > Probably the rate at which is called sys_sched_yield() is not so high to let > the performance improvement to be measurable. LinuxThreads mutexes call sched_yield() when a lock is locked, so when you have a multithreaded program with some lock

RE: sys_sched_yield fast path

2001-03-10 Thread Davide Libenzi
On 10-Mar-2001 Mike Kravetz wrote: > Any thoughts about adding a 'fast path' to the SMP code in > sys_sched_yield. Why not compare nr_pending to smp_num_cpus > before examining the aligned_data structures? Something like, > > if (nr_pending > smp_num_cpus) > goto set_resched_now; > >

RE: sys_sched_yield fast path

2001-03-10 Thread Davide Libenzi
On 10-Mar-2001 Mike Kravetz wrote: Any thoughts about adding a 'fast path' to the SMP code in sys_sched_yield. Why not compare nr_pending to smp_num_cpus before examining the aligned_data structures? Something like, if (nr_pending smp_num_cpus) goto set_resched_now; Where

Re: sys_sched_yield fast path

2001-03-10 Thread Andi Kleen
Davide Libenzi [EMAIL PROTECTED] writes: Probably the rate at which is called sys_sched_yield() is not so high to let the performance improvement to be measurable. LinuxThreads mutexes call sched_yield() when a lock is locked, so when you have a multithreaded program with some lock

sys_sched_yield fast path

2001-03-09 Thread Mike Kravetz
Any thoughts about adding a 'fast path' to the SMP code in sys_sched_yield. Why not compare nr_pending to smp_num_cpus before examining the aligned_data structures? Something like, if (nr_pending > smp_num_cpus) goto set_resched_now; Where set_resched_now is a label placed just before

sys_sched_yield fast path

2001-03-09 Thread Mike Kravetz
Any thoughts about adding a 'fast path' to the SMP code in sys_sched_yield. Why not compare nr_pending to smp_num_cpus before examining the aligned_data structures? Something like, if (nr_pending smp_num_cpus) goto set_resched_now; Where set_resched_now is a label placed just before