On 02.11.2023 18:46, Matthew Wilcox wrote: > On Thu, Nov 02, 2023 at 04:34:53PM +0100, Michal Wajdeczko wrote: >> Add helper function that will calculate number of allocated IDs >> in the IDA. This might be helpful both for drivers to estimate >> saturation of used IDs and for testing the IDA implementation. > > Since you take & release the lock, the value is already somewhat racy. > So why use the lock at all? Wouldn't the RCU read lock be a better > approach? I just followed pattern from ida_destroy() above. But rcu_read_lock() might be sufficient I guess. > > Also, does it make sense to specify it over a particular range rather > than over the whole IDA? But then implementation wont look that nice and easy ;) Anyway, I assume that this can be extended in the future if desired.