* linux-next: manual merge of the akpm tree with the workqueues tree
@ 2013-03-13 4:49 Stephen Rothwell
2013-03-13 19:46 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2013-03-13 4:49 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-next, linux-kernel, Tejun Heo
[-- Attachment #1: Type: text/plain, Size: 2667 bytes --]
Hi Andrew,
Today's linux-next merge of the akpm tree got a conflict in
kernel/workqueue.c between commit fa1b54e69bc6 ("workqueue: update
synchronization rules on worker_pool_idr") from the workqueues tree and
commit "workqueue: convert to idr_alloc()" from the akpm tree.
I fixed it up (I think - see below) and can carry the fix as necessary
(no action is required).
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --cc kernel/workqueue.c
index 2f43753,09bee1d..0000000
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@@ -456,31 -456,40 +456,31 @@@ static int worker_pool_assign_id(struc
{
int ret;
- mutex_lock(&worker_pool_idr_mutex);
- ret = idr_alloc(&worker_pool_idr, pool, 0, 0, GFP_KERNEL);
- if (ret >= 0)
- pool->id = ret;
- mutex_unlock(&worker_pool_idr_mutex);
+ do {
- if (!idr_pre_get(&worker_pool_idr, GFP_KERNEL))
- return -ENOMEM;
-
++ idr_preload(GFP_KERNEL);
+ spin_lock_irq(&workqueue_lock);
- ret = idr_get_new(&worker_pool_idr, pool, &pool->id);
++ ret = idr_alloc(&worker_pool_idr, pool, 0, 0, GFP_NOWAIT);
++ if (ret >= 0)
++ pool->id = ret;
+ spin_unlock_irq(&workqueue_lock);
+ } while (ret == -EAGAIN);
- return ret;
+ return ret < 0 ? ret : 0;
}
-/*
- * Lookup worker_pool by id. The idr currently is built during boot and
- * never modified. Don't worry about locking for now.
+/**
+ * first_pwq - return the first pool_workqueue of the specified workqueue
+ * @wq: the target workqueue
+ *
+ * This must be called either with workqueue_lock held or sched RCU read
+ * locked. If the pwq needs to be used beyond the locking in effect, the
+ * caller is responsible for guaranteeing that the pwq stays online.
*/
-static struct worker_pool *worker_pool_by_id(int pool_id)
-{
- return idr_find(&worker_pool_idr, pool_id);
-}
-
-static struct worker_pool *get_std_worker_pool(int cpu, bool highpri)
-{
- struct worker_pool *pools = std_worker_pools(cpu);
-
- return &pools[highpri];
-}
-
-static struct pool_workqueue *get_pwq(unsigned int cpu,
- struct workqueue_struct *wq)
+static struct pool_workqueue *first_pwq(struct workqueue_struct *wq)
{
- if (!(wq->flags & WQ_UNBOUND)) {
- if (likely(cpu < nr_cpu_ids))
- return per_cpu_ptr(wq->pool_wq.pcpu, cpu);
- } else if (likely(cpu == WORK_CPU_UNBOUND))
- return wq->pool_wq.single;
- return NULL;
+ assert_rcu_or_wq_lock();
+ return list_first_or_null_rcu(&wq->pwqs, struct pool_workqueue,
+ pwqs_node);
}
static unsigned int work_color_to_flags(int color)
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: linux-next: manual merge of the akpm tree with the workqueues tree
2013-03-13 4:49 linux-next: manual merge of the akpm tree with the workqueues tree Stephen Rothwell
@ 2013-03-13 19:46 ` Andrew Morton
2013-03-13 20:51 ` Tejun Heo
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2013-03-13 19:46 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linux-next, linux-kernel, Tejun Heo
On Wed, 13 Mar 2013 15:49:05 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> Today's linux-next merge of the akpm tree got a conflict in
> kernel/workqueue.c between commit fa1b54e69bc6 ("workqueue: update
> synchronization rules on worker_pool_idr") from the workqueues tree and
> commit "workqueue: convert to idr_alloc()" from the akpm tree.
>
> I fixed it up (I think - see below) and can carry the fix as necessary
> (no action is required).
>
OK, thanks. I have workqueue-convert-to-idr_alloc.patch queued for 3.9
so I moved it ahead of linux-next.patch and made a mess.
Tejun, can you please confirm that this is how worker_pool_assign_id()
should look in linux-next?
static int worker_pool_assign_id(struct worker_pool *pool)
{
int ret;
do {
idr_preload(GFP_KERNEL);
spin_lock_irq(&workqueue_lock);
ret = idr_alloc(&worker_pool_idr, pool, 0, 0, GFP_NOWAIT);
if (ret >= 0)
pool->id = ret;
spin_unlock_irq(&workqueue_lock);
} while (ret == -EAGAIN);
return ret < 0 ? ret : 0;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: linux-next: manual merge of the akpm tree with the workqueues tree
2013-03-13 19:46 ` Andrew Morton
@ 2013-03-13 20:51 ` Tejun Heo
0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2013-03-13 20:51 UTC (permalink / raw)
To: Andrew Morton; +Cc: Stephen Rothwell, linux-next, linux-kernel
Hello, Andrew.
On Wed, Mar 13, 2013 at 12:46:24PM -0700, Andrew Morton wrote:
> Tejun, can you please confirm that this is how worker_pool_assign_id()
> should look in linux-next?
>
> static int worker_pool_assign_id(struct worker_pool *pool)
> {
> int ret;
>
> do {
> idr_preload(GFP_KERNEL);
> spin_lock_irq(&workqueue_lock);
> ret = idr_alloc(&worker_pool_idr, pool, 0, 0, GFP_NOWAIT);
> if (ret >= 0)
> pool->id = ret;
> spin_unlock_irq(&workqueue_lock);
idr_preload_end();
> } while (ret == -EAGAIN);
>
> return ret < 0 ? ret : 0;
> }
Other than that, it looks good to me.
Thanks!
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
* linux-next: manual merge of the akpm tree with the workqueues tree
@ 2013-02-15 6:50 Stephen Rothwell
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2013-02-15 6:50 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-next, linux-kernel, Sasha Levin, Tejun Heo
[-- Attachment #1: Type: text/plain, Size: 520 bytes --]
Hi Andrew,
Today's linux-next merge of the akpm tree got a conflict in
kernel/workqueue.c between commit 8d03ecfe4718 ("workqueue: reimplement
is_chained_work() using current_wq_worker()") from the workqueues tree
and commit "hlist: drop the node parameter from iterators" from the akpm
tree.
I fixed it up (the former removes the code changed by the latter, so I
did that) and can carry the fix as necessary (no action is required).
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-03-13 20:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-13 4:49 linux-next: manual merge of the akpm tree with the workqueues tree Stephen Rothwell
2013-03-13 19:46 ` Andrew Morton
2013-03-13 20:51 ` Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2013-02-15 6:50 Stephen Rothwell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).