Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 92a1f4bc authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Matthew Wilcox
Browse files

Add macros to replace direct uses of TASK_ flags



With the changes to support TASK_KILLABLE, ->state becomes a bitmask, and
moving these tests to convenience macros will fix all the users.

Signed-off-by: default avatarMatthew Wilcox <willy@linux.intel.com>
parent 4a6e9e2c
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -178,6 +178,22 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
/* in tsk->state again */
/* in tsk->state again */
#define TASK_DEAD		64
#define TASK_DEAD		64


/* Convenience macros for the sake of wake_up */
#define TASK_NORMAL		(TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE)
#define TASK_ALL		(TASK_NORMAL | TASK_STOPPED | TASK_TRACED)

/* get_task_state() */
#define TASK_REPORT		(TASK_RUNNING | TASK_INTERRUPTIBLE | \
				 TASK_UNINTERRUPTIBLE | TASK_STOPPED | \
				 TASK_TRACED)

#define task_is_traced(task)	((task->state & TASK_TRACED) != 0)
#define task_is_stopped(task)	((task->state & TASK_STOPPED) != 0)
#define task_is_stopped_or_traced(task)	\
			((task->state & (TASK_STOPPED | TASK_TRACED)) != 0)
#define task_contributes_to_load(task)	\
				((task->state & TASK_UNINTERRUPTIBLE) != 0)

#define __set_task_state(tsk, state_value)		\
#define __set_task_state(tsk, state_value)		\
	do { (tsk)->state = (state_value); } while (0)
	do { (tsk)->state = (state_value); } while (0)
#define set_task_state(tsk, state_value)		\
#define set_task_state(tsk, state_value)		\