it would be nice to avoid these temporary allocations if you passed the struct page info into alloc largest available  you could do something fancier here  like put the first ones on the stack and then kmalloc if more are necessary  but that would get pretty ugly or you could kmalloc them in blocks 