Skip to content

Commit

Permalink
sched/headers: Move the task_lock()/unlock() APIs to <linux/sched/tas…
Browse files Browse the repository at this point in the history
…k.h>

The task_lock()/task_unlock() APIs are not realated to core scheduling,
they are task lifetime APIs, i.e. they belong into <linux/sched/task.h>.

Move them.

Acked-by: Linus Torvalds <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Ingo Molnar committed Mar 3, 2017
1 parent cdc75e9 commit 56cd697
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
20 changes: 0 additions & 20 deletions include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -1526,26 +1526,6 @@ static inline unsigned long wait_task_inactive(struct task_struct *p,
}
#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);
}

/* set thread flags in other task's structures
* - see asm/thread_info.h for TIF_xxxx flags available
*/
Expand Down
20 changes: 20 additions & 0 deletions include/linux/sched/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
1 change: 1 addition & 0 deletions kernel/cgroup/cgroup-v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <linux/delay.h>
#include <linux/mm.h>
#include <linux/sched/signal.h>
#include <linux/sched/task.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/delayacct.h>
Expand Down
2 changes: 1 addition & 1 deletion kernel/cgroup/namespace.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "cgroup-internal.h"

#include <linux/sched.h>
#include <linux/sched/task.h>
#include <linux/slab.h>
#include <linux/nsproxy.h>
#include <linux/proc_ns.h>
Expand Down

0 comments on commit 56cd697

Please sign in to comment.