Yu Zhao wrote: > I think we can safely assume PAGE_SIZE is unsigned long aligned and > page->objects is non-zero. But if you don't feel comfortable with these > assumptions, I'd be happy to ensure them explicitly.
I know PAGE_SIZE is unsigned long aligned. If someone by chance happens to change from "dynamic allocation" to "on stack", get_order() will no longer be called and the bug will show up. I don't know whether __get_free_page(GFP_ATOMIC) can temporarily consume more than 4096 bytes, but if it can, we might want to avoid "dynamic allocation". By the way, if "struct kmem_cache_node" is object which won't have many thousands of instances, can't we embed that buffer into "struct kmem_cache_node" because max size of that buffer is only 4096 bytes?