Re: [PATCH 10 of 20] ipath - support for userspace apps using coredriver

From: Linus Torvalds
Date: Fri Mar 17 2006 - 11:27:03 EST

On Fri, 17 Mar 2006, Bryan O'Sullivan wrote:
> Hmm. Which of the implementations that you've seen will return
> something not backed by a struct page? On the half dozen arches I've
> looked at (i386/x86_64, powerpc, sparc64, ia64, mips), every one uses
> either kmalloc, __get_free_pages, or __alloc_pages at some point, and I
> think they all have struct pages behind them.

kmalloc may be backed by a "struct page", but the point is that it does
not honor the page _count_, and as such it is totally unsuitable for any
VM usage.

The VM relies on the page count very fundamentally, so by doing a
"get_page()" you'll tell every other user that you have a reference to a
page, and it won't be free'd until all references are gone. In contrast,
if you do a "get_page()" on something that has been allocated with
kmalloc(), the slab code will totally ignore it, and happily re-allocate
it to something else once the _original_ allocator free's it.

So kmalloc() really isn't appropriate.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at