On Tue, 31 Jul 2012, Glauber Costa wrote: > >> Or am I missing something ? > > > > Yes the refcounting is done at the page level by the page allocator. It is > > safe. The slab allocator can free a page removing all references from its > > internal structure while the subsystem page reference will hold off the > > page allocator from actually freeing the page until the subsystem itself > > drops the page count. > > > > pages, yes. But when you do kfree, you don't free a page. You free an > object. The allocator is totally free to keep the page around and pass > it on to someone else. That is understood. Typically these object where page sized though and various assumptions (pretty dangerous ones as you are finding out) are made regarding object reuse. The fallback of SLUB for higher order allocs to the page allocator avoids these problems for higher order pages. It would be better and cleaner if all callers would not use slab allocators but the page allocators directly for any page that requires an increased refcount for DMA operations. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>