Re: [PATCH RFC ticketlock] Auto-queued ticketlock

From: Paul E. McKenney
Date: Tue Jun 11 2013 - 17:09:28 EST


On Tue, Jun 11, 2013 at 04:56:50PM -0400, Steven Rostedt wrote:
> On Tue, 2013-06-11 at 12:49 -0700, Paul E. McKenney wrote:
>
> > +config TICKET_LOCK_QUEUED
> > + bool "Dynamically switch between ticket and queued locking"
> > + depends on SMP
> > + default n
> > + ---help---
> > + Enable dynamic switching between ticketlock and queued locking
> > + on a per-lock basis. This option will slow down low-contention
> > + acquisition and release very slightly (additional conditional
> > + in release path), but will provide more efficient operation at
> > + high levels of lock contention. High-contention operation will
> > + not be quite as efficient as would be a pure queued lock, but
> > + this dynamic approach consumes less memory than queud locks
> > + and also runs faster at low levels of contention.
> > +
> > + Say "Y" if you are running on a large system with a workload
> > + that is likely to result in high levels of contention.
> > +
> > + Say "N" if you are unsure.
> > +
> > +config TICKET_LOCK_QUEUED_SWITCH
> > + int "When to switch from ticket to queued locking"
> > + depends on TICKET_LOCK_QUEUED
> > + default 8
> > + range 3 32
> > + ---help---
> > + Specify how many tasks should be spinning on the lock before
> > + switching to queued mode. Systems with low-latency memory/cache
> > + interconnects will prefer larger numbers, while extreme low-latency
> > + and real-time workloads will prefer a smaller number. Of course,
> > + extreme real-time workloads would be even happier if contention
> > + on the locks were reduced to the point that there was never any
> > + need for queued locking in the first place.
>
> Are you sure real-time wants low numbers? I would think that real-time
> would want this off. This is just a way to help prevent cache ping
> ponging, but it adds to non-deterministic behavior. As I mentioned
> before, even though you fixed the thundering herd on setup, once the
> queue is set, then we will get a thundering herd of tasks trying to
> queue itself, and the task that was spinning the longest could very well
> become the one at the end of the FIFO.

Me? I think that real-time just wants contention to remain low, so that
this sort of thing isn't needed in the first place. And now that you
mention it, I suppose that is one of the few things that real-time and
real-fast workloads have in common.

But if you had some mixed workload on a large system that was mostly
real-fast, but had a real-time component, and if the real-fast portion
needed TICKET_LOCK_QUEUED=y, then I would guess that the real-time
portion would want a relatively low number for TICKET_LOCK_QUEUED_SWITCH.

Thanx, Paul

> -- Steve
>
>
>
> > +
> > + Take the default if you are unsure.
> > diff --git a/kernel/Makefile b/kernel/Makefile
>
>

--
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/