From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org,
linux-rt-users <linux-rt-users@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Carsten Emde <C.Emde@osadl.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Clark Williams <clark.williams@gmail.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: [RFC][PATCH RT 2/6] workqueue: Use rcu_read_lock_sched() to denote RCU synchronize_sched() location
Date: Wed, 26 Jun 2013 15:28:08 -0400 [thread overview]
Message-ID: <20130626193049.892149772@goodmis.org> (raw)
In-Reply-To: 20130626192806.107564905@goodmis.org
[-- Attachment #1: workqueue-rcu-sched.patch --]
[-- Type: text/plain, Size: 2073 bytes --]
Some functions in the workqueue code uses local_irq_disable() for the
RCU sched critical sections. That is, to make sure updates are done
using synchronize_sched() will synchronize with reader locations.
Unfortunately, local_irq_disable() is not very descriptive of what it
is used to protect, and disables interrupts for locations that do not
require interrupts disabled.
By using rcu_read_lock_sched(), we not only allow interrupts to be disabled
for shorter amounts of time, but also it documents nicely how the critical
section is being protected.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Index: linux-rt.git/kernel/workqueue.c
===================================================================
--- linux-rt.git.orig/kernel/workqueue.c
+++ linux-rt.git/kernel/workqueue.c
@@ -2766,14 +2766,15 @@ static bool start_flush_work(struct work
might_sleep();
- local_irq_disable();
+ rcu_read_lock_sched();
+
pool = get_work_pool(work);
if (!pool) {
- local_irq_enable();
+ rcu_read_unlock_sched();
return false;
}
- spin_lock(&pool->lock);
+ spin_lock_irq(&pool->lock);
/* see the comment in try_to_grab_pending() with the same code */
pwq = get_work_pwq(work);
if (pwq) {
@@ -2788,6 +2789,7 @@ static bool start_flush_work(struct work
insert_wq_barrier(pwq, barr, work, worker);
spin_unlock_irq(&pool->lock);
+ rcu_read_unlock_sched();
/*
* If @max_active is 1 or rescuer is in use, flushing another work
@@ -2804,6 +2806,7 @@ static bool start_flush_work(struct work
return true;
already_gone:
spin_unlock_irq(&pool->lock);
+ rcu_read_unlock_sched();
return false;
}
@@ -4366,7 +4369,7 @@ unsigned int work_busy(struct work_struc
if (work_pending(work))
ret |= WORK_BUSY_PENDING;
- local_irq_save(flags);
+ rcu_read_lock_sched();
pool = get_work_pool(work);
if (pool) {
spin_lock(&pool->lock);
@@ -4374,7 +4377,7 @@ unsigned int work_busy(struct work_struc
ret |= WORK_BUSY_RUNNING;
spin_unlock(&pool->lock);
}
- local_irq_restore(flags);
+ rcu_read_unlock_sched();
return ret;
}
next prev parent reply other threads:[~2013-06-26 19:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-26 19:28 [RFC][PATCH RT 0/6] rt: Updates to handle some 3.10 changes Steven Rostedt
2013-06-26 19:28 ` [RFC][PATCH RT 1/6] rt,rcu: Have rcu_read_lock_sched() use locks for PREEMPT_RT Steven Rostedt
2013-06-26 20:53 ` Paul E. McKenney
2013-06-26 21:32 ` Steven Rostedt
2013-06-27 3:52 ` Mike Galbraith
2013-06-27 11:28 ` Steven Rostedt
2013-06-26 19:28 ` Steven Rostedt [this message]
2013-06-26 19:28 ` [RFC][PATCH RT 3/6] idr: Use migrate_disable() to stay on the current CPU Steven Rostedt
2013-06-26 19:28 ` [RFC][PATCH RT 4/6] rt,workqueue: Add local_lock_irq() call to put_pwq_unlocked() Steven Rostedt
2013-06-26 19:28 ` [RFC][PATCH RT 5/6] rt,ntp: Move call to schedule_delayed_work() to helper thread Steven Rostedt
2013-06-26 19:28 ` [RFC][PATCH RT 6/6] vtime: Convert vtime_seqlock into raw_spinlock_t and seqcount combo Steven Rostedt
2013-07-10 17:12 ` Paul Gortmaker
2013-07-11 14:30 ` Steven Rostedt
2013-06-26 19:43 ` [RFC][PATCH RT 0.5/6] locallock: Add include of percpu.h Steven Rostedt
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=20130626193049.892149772@goodmis.org \
--to=rostedt@goodmis.org \
--cc=C.Emde@osadl.org \
--cc=bigeasy@linutronix.de \
--cc=clark.williams@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.