diff options
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r-- | kernel/workqueue.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 392be4b252f6..fc5d23d752a5 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -910,6 +910,26 @@ struct task_struct *wq_worker_sleeping(struct task_struct *task) | |||
910 | } | 910 | } |
911 | 911 | ||
912 | /** | 912 | /** |
913 | * wq_worker_last_func - retrieve worker's last work function | ||
914 | * | ||
915 | * Determine the last function a worker executed. This is called from | ||
916 | * the scheduler to get a worker's last known identity. | ||
917 | * | ||
918 | * CONTEXT: | ||
919 | * spin_lock_irq(rq->lock) | ||
920 | * | ||
921 | * Return: | ||
922 | * The last work function %current executed as a worker, NULL if it | ||
923 | * hasn't executed any work yet. | ||
924 | */ | ||
925 | work_func_t wq_worker_last_func(struct task_struct *task) | ||
926 | { | ||
927 | struct worker *worker = kthread_data(task); | ||
928 | |||
929 | return worker->last_func; | ||
930 | } | ||
931 | |||
932 | /** | ||
913 | * worker_set_flags - set worker flags and adjust nr_running accordingly | 933 | * worker_set_flags - set worker flags and adjust nr_running accordingly |
914 | * @worker: self | 934 | * @worker: self |
915 | * @flags: flags to set | 935 | * @flags: flags to set |
@@ -2184,6 +2204,9 @@ __acquires(&pool->lock) | |||
2184 | if (unlikely(cpu_intensive)) | 2204 | if (unlikely(cpu_intensive)) |
2185 | worker_clr_flags(worker, WORKER_CPU_INTENSIVE); | 2205 | worker_clr_flags(worker, WORKER_CPU_INTENSIVE); |
2186 | 2206 | ||
2207 | /* tag the worker for identification in schedule() */ | ||
2208 | worker->last_func = worker->current_func; | ||
2209 | |||
2187 | /* we're done with it, release */ | 2210 | /* we're done with it, release */ |
2188 | hash_del(&worker->hentry); | 2211 | hash_del(&worker->hentry); |
2189 | worker->current_work = NULL; | 2212 | worker->current_work = NULL; |