Commit aa55a086 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

[PATCH] fix TASK_STOPPED vs TASK_NONINTERACTIVE interaction

do_signal_stop:

	for_each_thread(t) {
		if (t->state < TASK_STOPPED)
			++sig->group_stop_count;
	}

However, TASK_NONINTERACTIVE > TASK_STOPPED, so this loop will not
count TASK_INTERRUPTIBLE | TASK_NONINTERACTIVE threads.

See also wait_task_stopped(), which checks ->state > TASK_STOPPED.
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>

[ We really probably should always use the appropriate bitmasks to test
  task states, not do it like this. Using something like

	#define TASK_RUNNABLE (TASK_RUNNING | TASK_INTERRUPTIBLE | \
				TASK_UNINTERRUPTIBLE | TASK_NONINTERACTIVE)

  and then doing "if (task->state & TASK_RUNNABLE)" or similar. But the
  ordering of the task states is historical, and keeping the ordering
  does make sense regardless. ]
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b20fd650
...@@ -110,11 +110,11 @@ extern unsigned long nr_iowait(void); ...@@ -110,11 +110,11 @@ extern unsigned long nr_iowait(void);
#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_NONINTERACTIVE 4
#define TASK_TRACED 8 #define TASK_STOPPED 8
#define EXIT_ZOMBIE 16 #define TASK_TRACED 16
#define EXIT_DEAD 32 #define EXIT_ZOMBIE 32
#define TASK_NONINTERACTIVE 64 #define EXIT_DEAD 64
#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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment