Re: [PATCH v2 1/2] locking: Implement an algorithm choice for Wound-Wait mutexes
From: Peter Zijlstra
Date: Thu Jun 14 2018 - 10:47:35 EST
On Thu, Jun 14, 2018 at 03:43:04PM +0200, Thomas Hellstrom wrote:
> It's intended to be enforced by storing the algorithm choice in the
> WW_MUTEX_CLASS which must be common for an acquire context and the
> ww_mutexes it acquires. However, I don't think there is a check that that
> holds. I guess we could add it as a DEBUG_MUTEX test in ww_mutex_lock().
There is ww_mutex_lock_acquired():
DEBUG_LOCKS_WARN_ON(ww_ctx->ww_class != ww->ww_class)
which should trigger if you try and be clever.