> So you conclude as it is not leak too? Then what are you trying to > fix?
I conclude there is no easily *visible* leak. At least not at first glance - not with single threaded code. > I am becoming more confused after this. :-/ I think adding kmemleak_not_leak() is hiding the fact that there actually is a leak. I think the leak is far more subtle. Possibly some sort of race condition or something. I don't see it though. The rcu doesn't seem entirely kosher, but I know little about such things. And I think the leak is *still* here. After all kmemleak_not_leak is purely annotation. It doesn't fix any leaks, it just makes us not warn about them. > > Basically AFAICT our use of __krealloc() is exactly like krealloc() > > except instead of kfree() we do kfree_rcu(). > > > > And thus I don't understand the need for kmemleak_not_leak(old). > > kfree_rcu() is a callback deferred after a grace period, so if we > allocate the memory again before that callback, it is reported to > kmemleak as a memory leak unless we mark it as not, right? > > Or kfree_rcu() works nicely with kmemleak which I am not aware > of? We have kfree_rcu() all over the kernel, but there's very few kmemleak_not_leak's. I don't see how kfree_rcu() could not work nicely with kmemleak. If it didn't we'd have it reporting leaks all over the place...