locking/rwsem: Use task->state helpers
authorDavidlohr Bueso <dave@stgolabs.net>
Mon, 26 Jan 2015 07:36:04 +0000 (23:36 -0800)
committerIngo Molnar <mingo@kernel.org>
Wed, 4 Feb 2015 06:57:39 +0000 (07:57 +0100)
Call __set_task_state() instead of assigning the new state
directly. These interfaces also aid CONFIG_DEBUG_ATOMIC_SLEEP
environments, keeping track of who last changed the state.

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: Jason Low <jason.low2@hp.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1422257769-14083-2-git-send-email-dave@stgolabs.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/locking/rwsem-spinlock.c
kernel/locking/rwsem-xadd.c

index 2c93571..2555ae1 100644 (file)
@@ -154,7 +154,7 @@ void __sched __down_read(struct rw_semaphore *sem)
                set_task_state(tsk, TASK_UNINTERRUPTIBLE);
        }
 
-       tsk->state = TASK_RUNNING;
+       __set_task_state(tsk, TASK_RUNNING);
  out:
        ;
 }
index 7628c3f..2f7cc40 100644 (file)
@@ -242,8 +242,7 @@ struct rw_semaphore __sched *rwsem_down_read_failed(struct rw_semaphore *sem)
                schedule();
        }
 
-       tsk->state = TASK_RUNNING;
-
+       __set_task_state(tsk, TASK_RUNNING);
        return sem;
 }
 EXPORT_SYMBOL(rwsem_down_read_failed);