Spin Lock Cache Exclusivity Yielding for NUMA Fairness

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing lock mechanisms, such as spin locks, suffer from performance degradation due to high contention in NUMA architectures, leading to locking unfairness and inefficiency, as they prioritize fairness over performance or vice versa, without effectively addressing the need for both in large-scale distributed shared memory multiprocessor systems.

Innovation Solution

A 'cooperative' feature is introduced to the spin lock mechanism, which ensures statistical locking fairness by explicitly yielding cache memory exclusivity after releasing a spin lock, thereby equalizing the chances of all contenders to acquire the lock, without requiring additional data structures or algorithms, thus maintaining performance at low contention.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If spin locks are used to achieve high performance at low contention, then locking performance is improved, but locking fairness deteriorates under high contention in NUMA architectures

Engineering Contradiction:
Improvelocking performanceVSAvoidlocking fairness
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent applies dynamics by making the cache exclusivity behavior adaptive based on lock release conditions. The cache coherency protocol dynamically adjusts whether to maintain or release exclusivity when a lock is released, depending on the specific circumstances (e.g., whether the releasing CPU is local or remote). This dynamic adjustment allows the system to achieve both fairness and performance by responding to different operational contexts.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The patent changes the parameter of cache exclusivity state from a static condition to a dynamic one that varies based on lock release scenarios. By modifying the cache coherency behavior parameter (maintain vs. release exclusivity) based on whether the releasing CPU is local or remote, the system optimizes both fairness and performance characteristics under different contention conditions.

Inventive Principle:
Principle #35Parameter changes

2Productivity

If cache exclusivity is maintained after lock release to improve performance, then locking performance is improved, but locking fairness deteriorates because local CPUs have advantage over remote CPUs

Engineering Contradiction:
Improvelocking performanceVSAvoidlocking fairness
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent applies local quality by treating local and remote CPU scenarios differently in terms of cache exclusivity handling. When a local CPU releases the lock, the cache maintains exclusivity for performance. When a remote CPU releases the lock, the cache releases exclusivity to ensure fairness. This differentiated treatment based on CPU location optimizes both performance and fairness characteristics.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The patent introduces asymmetry in cache exclusivity behavior based on the releasing CPU's location. Instead of uniform treatment, the system applies asymmetric policies: maintain exclusivity for local releases, release exclusivity for remote releases. This asymmetric approach addresses the performance-fairness tradeoff by recognizing the different implications of local versus remote CPU operations.

Inventive Principle:
Principle #4Asymmetry

3Reliability

If complex lock data structures and algorithms are introduced to achieve fairness, then locking fairness is improved, but locking latency overhead increases and performance at low contention deteriorates

Engineering Contradiction:
Improvelocking fairnessVSAvoidlock data structure complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent applies self-service by leveraging the existing cache coherency hardware mechanism to automatically provide fairness functionality. Instead of requiring software-based complex data structures, the system uses the cache coherency protocol's inherent capabilities (maintain/release exclusivity) to achieve fairness. The hardware itself serves the fairness function that would otherwise require complex software algorithms.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The patent substitutes mechanical/software complexity with hardware-based cache coherency mechanisms. Rather than using complex software data structures to manage fairness, the system relies on the cache coherency hardware's automatic exclusivity management. This substitution eliminates the need for additional software complexity while achieving the same fairness goals.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentEP2126704B1Achieving both locking fairness and locking performance with spin locks
Publication Date: 2014.07.23 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • EP2126704B1 patent drawingFigure 1
  • EP2126704B1 patent drawingFigure 2
  • EP2126704B1 patent drawingFigure 3

AI summary

A method for implementing a spin lock in a system including a plurality of processing nodes, each node including at least one processor and a cache memory, the method including steps of: acquiring exclusivity to the cache memory; checking the availability of the spin lock; setting the spin lock to logical one if the spin lock is available; setting the spin lock to logical zero once processing is complete; and explicitly yielding the cache memory exclusivity. Yielding the cache memory exclusivity includes instructing the cache coherent hardware to mark the cache memory as non-exclusive. The cache memory is typically called level two cache.