Re: [PATCH RFC ticketlock] Auto-queued ticketlock

From: Steven Rostedt
Date: Tue Jun 11 2013 - 16:56:57 EST

On Tue, 2013-06-11 at 12:49 -0700, Paul E. McKenney wrote:

> + 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.
> +
> + 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.

-- 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
Please read the FAQ at