On Mon, May 30, 2016 at 01:25:34PM -0700, Charles Cui wrote: > there is one remaining slot. And each of them will increase p_nsem by one > using atomic_inc, the results are we have 1 slot overused, but the error is > never detected.
You will have to use a _nv() variant and use the return value to compare that against the limit, then decrement in the error path. Martin