what is a compound page?

Submitted by Anonymous
on July 31, 2008 - 10:13am

While working on a redesign of how one of my drivers manages memory, I introduced a bug.

In short, I have memory that is allocated with get_free_pages. That memory is then mmap'ed into user space, and then I do O_DIRECT fops with that memory. This was causing me a 'bad page state' error.

Fortunately, I found this post: http://lists.linuxcoding.com/kernel/2005-q4/msg13899.html

In a 'hail mary' attempt to fix my bug, I tried adding __GFP_COMP to my allocation and it did the trick.

Now, I thought I knew most of the concepts of paging and was somewhat adept at manipulating the VM subsystem. Clearly, I do not -- this one is totally over my head. The comment near the definition of __GFP_COMP says something like "add compound page metadata". But what is a "compound page"? What are the semantics? Why isn't there always room for compound page metadata?

Thanks in advance for the schooling! :)

-Miles