From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-kernel@vger.kernel.org
Cc: Daniel Walker <dwalker@mvista.com>,
Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
Gregory Haskins <ghaskins@novell.com>,
Oleg Nesterov <oleg@tv-sign.ru>
Subject: [RFC/PATCH 7/5] rt: PI-workqueue: propagate prio for delayed work
Date: Tue, 23 Oct 2007 21:22:26 +0200 [thread overview]
Message-ID: <1193167347.5648.24.camel@lappy> (raw)
In-Reply-To: <20071023120357.782284000@chello.nl>
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 <a.p.zijlstra@chello.nl>
---
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);
prev parent reply other threads:[~2007-10-23 19:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-23 12:03 [RFC/PATCH 0/5] rt: workqueue PI support -v2 Peter Zijlstra
2007-10-23 12:03 ` [RFC/PATCH 1/5] rt: rename rt_mutex_setprio to task_setprio Peter Zijlstra
2007-10-23 12:03 ` [RFC/PATCH 2/5] rt: list_splice2 Peter Zijlstra
2007-10-23 14:08 ` Steven Rostedt
2007-10-23 12:04 ` [RFC/PATCH 3/5] rt: plist_head_splice Peter Zijlstra
2007-10-23 15:10 ` Steven Rostedt
2007-10-23 16:26 ` Peter Zijlstra
2007-10-23 17:45 ` Peter Zijlstra
2007-10-23 12:04 ` [RFC/PATCH 4/5] rt: PI-workqueue support Peter Zijlstra
2007-10-23 12:04 ` [RFC/PATCH 5/5] rt: PI-workqueue: fix barriers Peter Zijlstra
2007-10-23 19:22 ` [RFC/PATCH 6/5] rt: PI-workqueue: wait_on_work() fixup Peter Zijlstra
2007-10-23 19:22 ` Peter Zijlstra [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1193167347.5648.24.camel@lappy \
--to=a.p.zijlstra@chello.nl \
--cc=dwalker@mvista.com \
--cc=ghaskins@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@tv-sign.ru \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox