[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0805111604210.32758@titan.stealer.net>
Date: Sun, 11 May 2008 16:10:13 +0200 (CEST)
From: Sven Wegener <sven.wegener@...aler.net>
To: Matthew Wilcox <matthew@....cx>
cc: Ingo Molnar <mingo@...e.hu>,
Linus Torvalds <torvalds@...ux-foundation.org>,
"Zhang, Yanmin" <yanmin_zhang@...ux.intel.com>,
Andi Kleen <andi@...stfloor.org>,
LKML <linux-kernel@...r.kernel.org>,
Alexander Viro <viro@....linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [git pull] scheduler fixes
On Sun, 11 May 2008, Matthew Wilcox wrote:
> On Thu, May 08, 2008 at 05:10:28PM +0200, Ingo Molnar wrote:
>> @@ -258,7 +256,5 @@ static noinline void __sched __up(struct semaphore *sem)
>> {
>> struct semaphore_waiter *waiter = list_first_entry(&sem->wait_list,
>> struct semaphore_waiter, list);
>> - list_del(&waiter->list);
>> - waiter->up = 1;
>> wake_up_process(waiter->task);
>> }
>
> This might be the problem that causes the missing wakeups. If you have a
> semaphore with n=2, and four processes calling down(), tasks A and B
> acquire the semaphore and tasks C and D go to sleep. Task A calls up()
> and wakes up C. Then task B calls up() and doesn't wake up anyone
> because C hasn't run yet. I think we need another wakeup when task C
> finishes in __down_common, like this (on top of your patch):
>
> diff --git a/kernel/semaphore.c b/kernel/semaphore.c
> index 5e41217..e520ad4 100644
> --- a/kernel/semaphore.c
> +++ b/kernel/semaphore.c
> @@ -229,6 +229,11 @@ static inline int __sched __down_common(struct semaphore *sem, long state,
> }
>
> list_del(&waiter.list);
> +
> + /* It's possible we need to wake up the next task on the list too */
> + if (unlikely(sem->count > 1) && !list_empty(&sem->wait_list))
> + __up(sem);
> +
> return ret;
> }
>
> Sven, can you try this with your workload? I suspect this might be it
> because XFS does use semaphores with n>1.
This one fixes the regression too, after applying it on top of bf726e.
Sven
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists