[PATCH 3/4] introduce utrace_set_resume() helper
Oleg Nesterov
oleg at redhat.com
Thu Nov 19 02:15:58 UTC 2009
Introduce utrace_set_resume() helper (please rename to whatever
you like) to factor out the code in utrace_stop() and finish_report().
Note that utrace_set_resume() doesn have "task_struct *task" argument.
This is correct, the task must be current.
Signed-off-by: Oleg Nesterov <oleg at redhat.com>
---
kernel/utrace.c | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
--- UTRACE-PTRACE/kernel/utrace.c~3_SET_RESUME_HELPER 2009-11-19 02:40:52.000000000 +0100
+++ UTRACE-PTRACE/kernel/utrace.c 2009-11-19 02:55:42.000000000 +0100
@@ -833,6 +833,18 @@ void utrace_finish_stop(void)
}
}
+static void utrace_set_resume(struct utrace *utrace,
+ enum utrace_resume_action action)
+{
+ if (action < utrace->resume) {
+ utrace->resume = action;
+ if (action == UTRACE_INTERRUPT)
+ set_thread_flag(TIF_SIGPENDING);
+ else
+ set_thread_flag(TIF_NOTIFY_RESUME);
+ }
+}
+
/*
* Perform %UTRACE_STOP, i.e. block in TASK_TRACED until woken up.
* @task == current, @utrace == current->utrace, which is not locked.
@@ -844,17 +856,10 @@ static void utrace_stop(struct task_stru
{
relock:
spin_lock(&utrace->lock);
-
- if (action < utrace->resume) {
- /*
- * Ensure a reporting pass when we're resumed.
- */
- utrace->resume = action;
- if (action == UTRACE_INTERRUPT)
- set_thread_flag(TIF_SIGPENDING);
- else
- set_thread_flag(TIF_NOTIFY_RESUME);
- }
+ /*
+ * Ensure a reporting pass when we're resumed.
+ */
+ utrace_set_resume(utrace, action);
/*
* If the ENGINE_STOP bit is clear in utrace_flags, that means
@@ -1375,13 +1380,7 @@ static void finish_report(struct task_st
if (resume < utrace->resume) {
spin_lock(&utrace->lock);
- if (resume < utrace->resume) {
- utrace->resume = resume;
- if (resume == UTRACE_INTERRUPT)
- set_tsk_thread_flag(task, TIF_SIGPENDING);
- else
- set_tsk_thread_flag(task, TIF_NOTIFY_RESUME);
- }
+ utrace_set_resume(utrace, resume);
spin_unlock(&utrace->lock);
}
More information about the utrace-devel
mailing list