Add TASK_WAKEKILL
Set TASK_WAKEKILL for TASK_STOPPED and TASK_TRACED, add TASK_KILLABLE and use TASK_WAKEKILL in signal_wake_up() Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
This commit is contained in:
Родитель
338077e54e
Коммит
f021a3c2b1
|
@ -170,27 +170,33 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
|
||||||
#define TASK_RUNNING 0
|
#define TASK_RUNNING 0
|
||||||
#define TASK_INTERRUPTIBLE 1
|
#define TASK_INTERRUPTIBLE 1
|
||||||
#define TASK_UNINTERRUPTIBLE 2
|
#define TASK_UNINTERRUPTIBLE 2
|
||||||
#define TASK_STOPPED 4
|
#define __TASK_STOPPED 4
|
||||||
#define TASK_TRACED 8
|
#define __TASK_TRACED 8
|
||||||
/* in tsk->exit_state */
|
/* in tsk->exit_state */
|
||||||
#define EXIT_ZOMBIE 16
|
#define EXIT_ZOMBIE 16
|
||||||
#define EXIT_DEAD 32
|
#define EXIT_DEAD 32
|
||||||
/* in tsk->state again */
|
/* in tsk->state again */
|
||||||
#define TASK_DEAD 64
|
#define TASK_DEAD 64
|
||||||
|
#define TASK_WAKEKILL 128
|
||||||
|
|
||||||
|
/* Convenience macros for the sake of set_task_state */
|
||||||
|
#define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)
|
||||||
|
#define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED)
|
||||||
|
#define TASK_TRACED (TASK_WAKEKILL | __TASK_TRACED)
|
||||||
|
|
||||||
/* Convenience macros for the sake of wake_up */
|
/* Convenience macros for the sake of wake_up */
|
||||||
#define TASK_NORMAL (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE)
|
#define TASK_NORMAL (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE)
|
||||||
#define TASK_ALL (TASK_NORMAL | TASK_STOPPED | TASK_TRACED)
|
#define TASK_ALL (TASK_NORMAL | __TASK_STOPPED | __TASK_TRACED)
|
||||||
|
|
||||||
/* get_task_state() */
|
/* get_task_state() */
|
||||||
#define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \
|
#define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \
|
||||||
TASK_UNINTERRUPTIBLE | TASK_STOPPED | \
|
TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \
|
||||||
TASK_TRACED)
|
__TASK_TRACED)
|
||||||
|
|
||||||
#define task_is_traced(task) ((task->state & TASK_TRACED) != 0)
|
#define task_is_traced(task) ((task->state & __TASK_TRACED) != 0)
|
||||||
#define task_is_stopped(task) ((task->state & TASK_STOPPED) != 0)
|
#define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0)
|
||||||
#define task_is_stopped_or_traced(task) \
|
#define task_is_stopped_or_traced(task) \
|
||||||
((task->state & (TASK_STOPPED | TASK_TRACED)) != 0)
|
((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
|
||||||
#define task_contributes_to_load(task) \
|
#define task_contributes_to_load(task) \
|
||||||
((task->state & TASK_UNINTERRUPTIBLE) != 0)
|
((task->state & TASK_UNINTERRUPTIBLE) != 0)
|
||||||
|
|
||||||
|
|
|
@ -456,15 +456,15 @@ void signal_wake_up(struct task_struct *t, int resume)
|
||||||
set_tsk_thread_flag(t, TIF_SIGPENDING);
|
set_tsk_thread_flag(t, TIF_SIGPENDING);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For SIGKILL, we want to wake it up in the stopped/traced case.
|
* For SIGKILL, we want to wake it up in the stopped/traced/killable
|
||||||
* We don't check t->state here because there is a race with it
|
* case. We don't check t->state here because there is a race with it
|
||||||
* executing another processor and just now entering stopped state.
|
* executing another processor and just now entering stopped state.
|
||||||
* By using wake_up_state, we ensure the process will wake up and
|
* By using wake_up_state, we ensure the process will wake up and
|
||||||
* handle its death signal.
|
* handle its death signal.
|
||||||
*/
|
*/
|
||||||
mask = TASK_INTERRUPTIBLE;
|
mask = TASK_INTERRUPTIBLE;
|
||||||
if (resume)
|
if (resume)
|
||||||
mask |= TASK_STOPPED | TASK_TRACED;
|
mask |= TASK_WAKEKILL;
|
||||||
if (!wake_up_state(t, mask))
|
if (!wake_up_state(t, mask))
|
||||||
kick_process(t);
|
kick_process(t);
|
||||||
}
|
}
|
||||||
|
@ -620,7 +620,7 @@ static void handle_stop_signal(int sig, struct task_struct *p)
|
||||||
* Wake up the stopped thread _after_ setting
|
* Wake up the stopped thread _after_ setting
|
||||||
* TIF_SIGPENDING
|
* TIF_SIGPENDING
|
||||||
*/
|
*/
|
||||||
state = TASK_STOPPED;
|
state = __TASK_STOPPED;
|
||||||
if (sig_user_defined(t, SIGCONT) && !sigismember(&t->blocked, SIGCONT)) {
|
if (sig_user_defined(t, SIGCONT) && !sigismember(&t->blocked, SIGCONT)) {
|
||||||
set_tsk_thread_flag(t, TIF_SIGPENDING);
|
set_tsk_thread_flag(t, TIF_SIGPENDING);
|
||||||
state |= TASK_INTERRUPTIBLE;
|
state |= TASK_INTERRUPTIBLE;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче