Re: [patch 0/5] seqlock consolidation

From: Thomas Gleixner
Date: Thu Mar 15 2012 - 08:28:15 EST


On Thu, 15 Mar 2012, Al Viro wrote:

> On Thu, Mar 15, 2012 at 11:44:22AM -0000, Thomas Gleixner wrote:
>
> > Aside of that replacing open coded constructs with proper functions is
> > a worthwhile cleanup by itself.
>
> Provided that those are proper primitives to start with... I don't like
> it - most of ->d_lock uses are _not_ related to ->d_seq, to start with
> and then we get an interesting mix of functions that do and do not assume
> the lock already taken, etc.
>
> Could you describe RT patch problems in more details? I really don't like
> this solution - interface is overcomplicated and doesn't fit well...

On RT the spinlock sections (except the raw_spinlock) ones are
becoming preemtible as we replace the spinlocks by "sleeping
spinlock", a PI aware rtmutex.

So now assume the following:

spin_lock(d->d_lock);
....
d->d_seq++;

-> Preemption
read_seqcount_begin()

repeat:
ret = ACCESS_ONCE(sl->sequence);
if (unlikely(ret & 1)) {
cpu_relax();
goto repeat;
}
smp_rmb();

Now when the preempting task has higher prioriy, the thing loops
forever. Fail ....

The only way out is to lock d->d_lock which is contended, so the
reader side boosts the writer and waits for the lock to be
released. Though with the open coded seqlock we have no idea which
lock we need to take.

Any better ideas ?

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/