Re: [PATCH 4/9] move x86's simple heap management to common code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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).

drew
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm




[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux