On Thu, Jan 02, 2014 at 04:17:08PM +0100, Andrew Jones wrote: > On Sat, Dec 28, 2013 at 10:30:24PM -0800, Christoffer Dall wrote: > > > + > > > + if (s != (s & ~(pagesize - 1))) { > > > > you're just testing 'if (s & (pagesize -1))' right? > > yeah, I'll simplify that. > > > > > > + s += pagesize; > > > + s &= ~(pagesize - 1); > > > + p = (void *)s; > > > + } > > > > a one-line comment on this block saying 'page-align start of heap would > > be nice. > > added > > > > > > + > > > + while (size >= pagesize) { > > > + *(void **)p = free_head; > > > + free_head = p; > > > + p += pagesize; > > > + size -= pagesize; > > > + } > > > > you could also be nice and comment this block of code, saying something > > like "set up linked list of free pages using the pages themselves as the > > data structure" if you should feel so inclined. > > added "link free pages" > > > > > why are you not trusting start to be page aligned but you are trusting > > size to be? If size is smaller than pagesize then this loop will go > > nuts won't it? > > I don't see how. As soon as size is less than pagesize we won't > [re]enter the loop, and thus it can never go negative (big positive). > yeah you're right. duh. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html