Subject: rt: PI-workqueue: propagate prio for delayed work
Delayed work looses its enqueue priority, and will be enqueued on the prio
of the softirq thread. Ammend this.
Signed-off-by: Peter Zijlstra <[email protected]>
---
include/linux/workqueue.h | 1 +
kernel/workqueue.c | 16 ++++++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
Index: linux-2.6/include/linux/workqueue.h
===================================================================
--- linux-2.6.orig/include/linux/workqueue.h
+++ linux-2.6/include/linux/workqueue.h
@@ -36,6 +36,7 @@ struct work_struct {
struct delayed_work {
struct work_struct work;
struct timer_list timer;
+ int prio;
};
struct execute_work {
Index: linux-2.6/kernel/workqueue.c
===================================================================
--- linux-2.6.orig/kernel/workqueue.c
+++ linux-2.6/kernel/workqueue.c
@@ -149,12 +149,12 @@ static void insert_work(struct cpu_workq
/* Preempt must be disabled. */
static void __queue_work(struct cpu_workqueue_struct *cwq,
- struct work_struct *work)
+ struct work_struct *work, int prio)
{
unsigned long flags;
spin_lock_irqsave(&cwq->lock, flags);
- insert_work(cwq, work, current->normal_prio, current->normal_prio);
+ insert_work(cwq, work, prio, prio);
spin_unlock_irqrestore(&cwq->lock, flags);
}
@@ -176,7 +176,7 @@ int fastcall queue_work(struct workqueue
if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) {
BUG_ON(!plist_node_empty(&work->entry));
- __queue_work(wq_per_cpu(wq, cpu), work);
+ __queue_work(wq_per_cpu(wq, cpu), work, current->normal_prio);
ret = 1;
}
return ret;
@@ -189,7 +189,8 @@ void delayed_work_timer_fn(unsigned long
struct cpu_workqueue_struct *cwq = get_wq_data(&dwork->work);
struct workqueue_struct *wq = cwq->wq;
- __queue_work(wq_per_cpu(wq, raw_smp_processor_id()), &dwork->work);
+ __queue_work(wq_per_cpu(wq, raw_smp_processor_id()),
+ &dwork->work, dwork->prio);
}
/**
@@ -232,6 +233,7 @@ int queue_delayed_work_on(int cpu, struc
BUG_ON(!plist_node_empty(&work->entry));
/* This stores cwq for the moment, for the timer_fn */
+ dwork->prio = current->normal_prio;
set_wq_data(work, wq_per_cpu(wq, raw_smp_processor_id()));
timer->expires = jiffies + delay;
timer->data = (unsigned long)dwork;
@@ -702,7 +704,8 @@ int schedule_on_each_cpu(void (*func)(vo
work->info = info;
INIT_WORK(&work->work, schedule_on_each_cpu_func);
set_bit(WORK_STRUCT_PENDING, work_data_bits(&work->work));
- __queue_work(per_cpu_ptr(keventd_wq->cpu_wq, cpu), &work->work);
+ __queue_work(per_cpu_ptr(keventd_wq->cpu_wq, cpu),
+ &work->work, current->normal_prio);
}
unlock_cpu_hotplug();
@@ -749,7 +752,8 @@ int schedule_on_each_cpu_wq(struct workq
INIT_WORK(work, func);
set_bit(WORK_STRUCT_PENDING, work_data_bits(work));
- __queue_work(per_cpu_ptr(wq->cpu_wq, cpu), work);
+ __queue_work(per_cpu_ptr(wq->cpu_wq, cpu), work,
+ current->normal_prio);
}
flush_workqueue(wq);
free_percpu(works);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]