On Sun, Nov 09, 2014 at 09:06:40AM +0100, Maxime Villard wrote: > Le 08/11/2014 23:28, Jean-Yves Migeon a ??crit : > > Yes, but still, what's the point of giving a size then? If the kernel > knows the size, we can remove kmem_free's size argument, otherwise it > is inconsistent. > > And then, as I said, we lose the memory optimisation: one more kmem page > is allocated to hold the size.
I'm not in favor of that. Also, my experience porting a great deal of code from a very old 4.4BSD kernel to NetBSD several years ago was that in converting the code from malloc to kmem_alloc, I found a _lot_ of bugs -- use after frees, double frees, etc. -- because you had to keep much more careful track of what exactly you were freeing, and when, in order to know its size. I don't think we should give that up (though I think the pool allocators are even better in this regard and that perhaps it is use of any variable-size allocator that should be discouraged). Thor
