From: Andrew Liu <shengping.liu@windriver.com>
To: unlisted-recipients:; (no To-header on input)
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] workqueue: Remove redundant function invocation
Date: Mon, 28 Apr 2008 17:19:46 +0900 [thread overview]
Message-ID: <481588A2.3090706@windriver.com> (raw)
workqueue: Remove redundant function invocation
timer_stats_timer_set_start_info is invoked twice,
additionally, the invocation of this function can be moved to
where it is only called when a delay is really required.
Signed-off-by: Andrew Liu <shengping.liu@windriver.com>
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 00ff4d0..9b50a4d 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -195,10 +195,10 @@ static void delayed_work_timer_fn(unsigned long
__data)
int queue_delayed_work(struct workqueue_struct *wq,
struct delayed_work *dwork, unsigned long delay)
{
- timer_stats_timer_set_start_info(&dwork->timer);
if (delay == 0)
return queue_work(wq, &dwork->work);
+ timer_stats_timer_set_start_info(&dwork->timer);
return queue_delayed_work_on(-1, wq, dwork, delay);
}
EXPORT_SYMBOL_GPL(queue_delayed_work);
@@ -219,11 +219,12 @@ int queue_delayed_work_on(int cpu, struct
workqueue_struct *wq,
struct timer_list *timer = &dwork->timer;
struct work_struct *work = &dwork->work;
- timer_stats_timer_set_start_info(&dwork->timer);
if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) {
BUG_ON(timer_pending(timer));
BUG_ON(!list_empty(&work->entry));
+ timer_stats_timer_set_start_info(&dwork->timer);
+ /* This stores cwq for the moment, for the
timer_fn */
set_wq_data(work, wq_per_cpu(wq, raw_smp_processor_id()));
timer->expires = jiffies + delay;
@@ -564,7 +565,6 @@ EXPORT_SYMBOL(schedule_work);
int schedule_delayed_work(struct delayed_work *dwork,
unsigned long delay)
{
- timer_stats_timer_set_start_info(&dwork->timer);
return queue_delayed_work(keventd_wq, dwork, delay);
}
EXPORT_SYMBOL(schedule_delayed_work);
@@ -581,7 +581,6 @@ EXPORT_SYMBOL(schedule_delayed_work);
int schedule_delayed_work_on(int cpu,
struct delayed_work *dwork, unsigned long delay)
{
- timer_stats_timer_set_start_info(&dwork->timer);
return queue_delayed_work_on(cpu, keventd_wq, dwork, delay);
}
EXPORT_SYMBOL(schedule_delayed_work_on);
next reply other threads:[~2008-04-28 9:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-28 8:19 Andrew Liu [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-04-29 7:54 [PATCH] workqueue: Remove redundant function invocation Andrew Liu
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=481588A2.3090706@windriver.com \
--to=shengping.liu@windriver.com \
--cc=linux-kernel@vger.kernel.org \
/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