datastruct/existence: reject --nreaders instead of hanging
Both existence_3hash_uperf.c and existence_3skiplist_uperf.c accept a
--nreaders argument and carry nlookups / nlookupfails in struct perftest_attr,
but no reader threads are ever created: perftest() creates nupdaters threads
and nothing else. The startup barrier, however, waits for all of them:
while (atomic_read(&nthreads_running) < nreaders + nupdaters)
poll(NULL, 0, 1);
so any --nreaders N with N greater than zero spins there forever. The option
is undocumented -- usage() does not list it -- and nlookups / nlookupfails are
zeroed and then neither incremented nor printed, so the reader support appears
to be vestigial rather than half-finished.
The default is 0, so this never bites in normal use; it only bites someone who
discovers the option in the source and tries it, which is how I found it.
Make the option fail fast with a clear message rather than hang. Deleting the
scaffolding outright (the nreaders variable, the parse arm, the barrier term,
and the two unused counters) is the obvious alternative, but that presumes
reader threads are not wanted later, which is not my call to make.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
2 files changed