lkml.org 
[lkml]   [2010]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/4] cpu_stop: implement stop_cpu[s]()
From
Date
On Thu, 2010-04-22 at 18:09 +0200, Tejun Heo wrote:
> +static int cpu_stopper_thread(void *data)
> +{
> + struct cpu_stopper *stopper = data;

BUG_ON(stopper != __get_cpu_var(cpu_stopper)); ?

> + work = NULL;
> + spin_lock_irq(&stopper->lock);
> + if (!list_empty(&stopper->works)) {
> + work = list_first_entry(&stopper->works,
> + struct cpu_stop_work, list);
> + list_del_init(&work->list);
> + }
> + spin_unlock_irq(&stopper->lock);

Not sure if its worth the hassle, but you could list_splice_init() the
complete pending list onto a local list, possible avoiding some locks.

But since this isn't supposed to be used much, I doubt we'll ever see
the difference.

> + /* restore preemption and check it's still balanced */
> + preempt_enable();
> + WARN_ON_ONCE(preempt_count());

You would use WARN_ONCE() and print the function that last ran and
leaked the preempt count.




\
 
 \ /
  Last update: 2010-05-03 15:29    [from the cache]
©2003-2011 Jasper Spaans