]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
locking/mutex: Explicitly mark task as running after wakeup
authorDavidlohr Bueso <dave@stgolabs.net>
Tue, 20 Jan 2015 01:39:21 +0000 (17:39 -0800)
committerIngo Molnar <mingo@kernel.org>
Wed, 4 Feb 2015 06:57:33 +0000 (07:57 +0100)
By the time we wake up and get the lock after being asleep
in the slowpath, we better be running. As good practice,
be explicit about this and avoid any mischief.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1421717961.4903.11.camel@stgolabs.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/locking/mutex.c

index c67a60b616257302ce956dab59a8e64ee07aa800..57407062e209a25451c4b3aee5bf703b32c0a922 100644 (file)
@@ -587,6 +587,8 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
                schedule_preempt_disabled();
                spin_lock_mutex(&lock->wait_lock, flags);
        }
+       __set_task_state(task, TASK_RUNNING);
+
        mutex_remove_waiter(lock, &waiter, current_thread_info());
        /* set it to 0 if there are no waiters left: */
        if (likely(list_empty(&lock->wait_list)))