]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branch 'master' into for-next
authorTejun Heo <tj@kernel.org>
Wed, 20 Mar 2013 17:23:34 +0000 (10:23 -0700)
committerTejun Heo <tj@kernel.org>
Wed, 20 Mar 2013 17:23:34 +0000 (10:23 -0700)
Conflicts:
kernel/workqueue.c

1  2 
kernel/workqueue.c

index ef1fd6ab3fb4c74db393cc09ef5548d4ea73ddb4,b48cd597145dd007b503d22755c481256f48867e..509a925c5780f1a9f6127ec1e28e7de0392e6a2c
@@@ -488,30 -456,40 +488,29 @@@ static int worker_pool_assign_id(struc
  {
        int ret;
  
 -      mutex_lock(&worker_pool_idr_mutex);
 +      lockdep_assert_held(&wq_mutex);
 +
-       do {
-               if (!idr_pre_get(&worker_pool_idr, GFP_KERNEL))
-                       return -ENOMEM;
-               ret = idr_get_new(&worker_pool_idr, pool, &pool->id);
-       } while (ret == -EAGAIN);
+       ret = idr_alloc(&worker_pool_idr, pool, 0, 0, GFP_KERNEL);
 -      if (ret >= 0)
++      if (ret >= 0) {
+               pool->id = ret;
 -      mutex_unlock(&worker_pool_idr_mutex);
 -
 -      return ret < 0 ? ret : 0;
++              return 0;
++      }
 +      return ret;
  }
  
 -/*
 - * 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 pwq_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_pwq_lock();
 +      return list_first_or_null_rcu(&wq->pwqs, struct pool_workqueue,
 +                                    pwqs_node);
  }
  
  static unsigned int work_color_to_flags(int color)