diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2008-06-11 16:04:29 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2008-07-16 17:27:03 -0400 |
commit | ebb12db51f6c13b30752fcf506baad4c617b153c (patch) | |
tree | 55c08b82463ffd5b78a8bc4a4748261b02391593 /include | |
parent | d20a4dca47d2cd027ed58a13f91b424affd1f449 (diff) |
Freezer: Introduce PF_FREEZER_NOSIG
The freezer currently attempts to distinguish kernel threads from
user space tasks by checking if their mm pointer is unset and it
does not send fake signals to kernel threads. However, there are
kernel threads, mostly related to networking, that behave like
user space tasks and may want to be sent a fake signal to be frozen.
Introduce the new process flag PF_FREEZER_NOSIG that will be set
by default for all kernel threads and make the freezer only send
fake signals to the tasks having PF_FREEZER_NOSIG unset. Provide
the set_freezable_with_signal() function to be called by the kernel
threads that want to be sent a fake signal for freezing.
This patch should not change the freezer's observable behavior.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/freezer.h | 10 | ||||
-rw-r--r-- | include/linux/sched.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/freezer.h b/include/linux/freezer.h index 08934995c7ab..deddeedf3257 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h | |||
@@ -128,6 +128,15 @@ static inline void set_freezable(void) | |||
128 | } | 128 | } |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * Tell the freezer that the current task should be frozen by it and that it | ||
132 | * should send a fake signal to the task to freeze it. | ||
133 | */ | ||
134 | static inline void set_freezable_with_signal(void) | ||
135 | { | ||
136 | current->flags &= ~(PF_NOFREEZE | PF_FREEZER_NOSIG); | ||
137 | } | ||
138 | |||
139 | /* | ||
131 | * Freezer-friendly wrappers around wait_event_interruptible() and | 140 | * Freezer-friendly wrappers around wait_event_interruptible() and |
132 | * wait_event_interruptible_timeout(), originally defined in <linux/wait.h> | 141 | * wait_event_interruptible_timeout(), originally defined in <linux/wait.h> |
133 | */ | 142 | */ |
@@ -174,6 +183,7 @@ static inline void freezer_do_not_count(void) {} | |||
174 | static inline void freezer_count(void) {} | 183 | static inline void freezer_count(void) {} |
175 | static inline int freezer_should_skip(struct task_struct *p) { return 0; } | 184 | static inline int freezer_should_skip(struct task_struct *p) { return 0; } |
176 | static inline void set_freezable(void) {} | 185 | static inline void set_freezable(void) {} |
186 | static inline void set_freezable_with_signal(void) {} | ||
177 | 187 | ||
178 | #define wait_event_freezable(wq, condition) \ | 188 | #define wait_event_freezable(wq, condition) \ |
179 | wait_event_interruptible(wq, condition) | 189 | wait_event_interruptible(wq, condition) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 21349173d148..ba2f859c6e4f 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1494,6 +1494,7 @@ static inline void put_task_struct(struct task_struct *t) | |||
1494 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ | 1494 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ |
1495 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ | 1495 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ |
1496 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ | 1496 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ |
1497 | #define PF_FREEZER_NOSIG 0x80000000 /* Freezer won't send signals to it */ | ||
1497 | 1498 | ||
1498 | /* | 1499 | /* |
1499 | * Only the _current_ task can read/write to tsk->flags, but other | 1500 | * Only the _current_ task can read/write to tsk->flags, but other |