Re: [PATCH 1/2] sched: Add schedule_(raw_)spin_unlock andschedule_(raw_)spin_unlock_irq

From: Thomas Gleixner
Date: Mon Jun 24 2013 - 08:54:49 EST


On Tue, 18 Jun 2013, Kirill Tkhai wrote:
> +/*
> + * schedule_raw_spin_unlock() -- should be used instead of pattern:
> + *
> + * raw_spin_unlock(lock);
> + * schedule();
> + *
> + * It's the same, but prevents preempt_schedule() call during the unlocking.
> + */
> +static inline void schedule_raw_spin_unlock(raw_spinlock_t *lock)

This should be raw_spin_unlock_and_schedule().

schedule_raw_spin_unlock() sounds like we schedule a raw_spin_unlock()
for some point in the future.

> +{
> + _raw_spin_unlock_no_resched(lock);

No, please do not expose such an interface. Instead of that implement
it as:

raw_spin_unlock_and_schedule()
{
spin_release(&lock->dep_map, 1, _RET_IP_);
do_raw_spin_unlock(lock);
preempt_enable_no_resched();
schedule();
}

And this goes into the spinlock header and not into sched.h.

Thanks,

tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/