]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/linux/sched/task.h
sched/headers: Move the task_lock()/unlock() APIs to <linux/sched/task.h>
[karo-tx-linux.git] / include / linux / sched / task.h
index 1be049a18d1bce18b5c164067371f5dfa88d87f8..2be9fde588a71a653c0e22834700ce618b8a855a 100644 (file)
@@ -91,4 +91,24 @@ static inline struct vm_struct *task_stack_vm_area(const struct task_struct *t)
 }
 #endif
 
+/*
+ * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
+ * subscriptions and synchronises with wait4().  Also used in procfs.  Also
+ * pins the final release of task.io_context.  Also protects ->cpuset and
+ * ->cgroup.subsys[]. And ->vfork_done.
+ *
+ * Nests both inside and outside of read_lock(&tasklist_lock).
+ * It must not be nested with write_lock_irq(&tasklist_lock),
+ * neither inside nor outside.
+ */
+static inline void task_lock(struct task_struct *p)
+{
+       spin_lock(&p->alloc_lock);
+}
+
+static inline void task_unlock(struct task_struct *p)
+{
+       spin_unlock(&p->alloc_lock);
+}
+
 #endif /* _LINUX_SCHED_TASK_H */