Re: [PATCH v5 07/15] locking/lockdep: Free lock classes that are no longer in use

From: Bart Van Assche
Date: Thu Jan 10 2019 - 13:51:33 EST


On Thu, 2019-01-10 at 16:24 +-0100, Peter Zijlstra wrote:
+AD4 /+ACo
+AD4 +ACo A data structure for delayed freeing of data structures that may be
+AD4 - +ACo accessed by RCU readers at the time these were freed. The size of the array
+AD4 - +ACo is a compromise between minimizing the amount of memory used by this array
+AD4 - +ACo and minimizing the number of wait+AF8-event() calls by get+AF8-pending+AF8-free+AF8-lock().
+AD4 +- +ACo accessed by RCU readers at the time these were freed.
+AD4 +ACo-/
+AD4 static struct pending+AF8-free +AHs
+AD4 - struct list+AF8-head zapped+AF8-classes+ADs
+AD4 struct rcu+AF8-head rcu+AF8-head+ADs
+AD4 +- int index+ADs
+AD4 int pending+ADs
+AD4 -+AH0 pending+AF8-free+AFs-2+AF0AOw
+AD4 -static DECLARE+AF8-WAIT+AF8-QUEUE+AF8-HEAD(rcu+AF8-cb)+ADs
+AD4 +- struct list+AF8-head zapped+AFs-2+AF0AOw
+AD4 +-+AH0 pending+AF8-free+ADs

Hi Peter,

If the zapped+AFsAXQ array only has two elements there is no guarantee that an
element will be free when zap+AF8-class() is called. I think we need at least
num+AF8-online+AF8-cpus() elements to guarantee that at least one element is free
when zap+AF8-class() is called. So removing the wait loop from
get+AF8-pending+AF8-free+AF8-lock() seems wrong to me. Have you tried to run a workload
that keeps all CPUs busy and that triggers get+AF8-pending+AF8-free+AF8-lock()
frequently?

Thanks,

Bart.