vm: restore sanity checks in NONCONTIGUOUS case.
This commit is contained in:
parent
068944de36
commit
16d0609fad
1 changed files with 15 additions and 13 deletions
|
@ -421,6 +421,17 @@ PRIVATE PUBLIC phys_bytes alloc_pages(int pages, int memflags, phys_bytes *len)
|
||||||
int finalnodes, finalpages;
|
int finalnodes, finalpages;
|
||||||
int largest;
|
int largest;
|
||||||
|
|
||||||
|
#if NONCONTIGUOUS
|
||||||
|
/* If NONCONTIGUOUS is on, allocate physical pages single
|
||||||
|
* pages at a time, accomplished by returning single pages
|
||||||
|
* if the caller can handle that (indicated by PAF_FIRSTBLOCK).
|
||||||
|
*/
|
||||||
|
if(memflags & PAF_FIRSTBLOCK) {
|
||||||
|
assert(!(memflags & PAF_CONTIG));
|
||||||
|
pages = 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
memstats(&firstnodes, &firstpages, &largest);
|
memstats(&firstnodes, &firstpages, &largest);
|
||||||
sanitycheck();
|
sanitycheck();
|
||||||
wantnodes = firstnodes;
|
wantnodes = firstnodes;
|
||||||
|
@ -435,17 +446,6 @@ PRIVATE PUBLIC phys_bytes alloc_pages(int pages, int memflags, phys_bytes *len)
|
||||||
incr = 0;
|
incr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NONCONTIGUOUS
|
|
||||||
/* If NONCONTIGUOUS is on, allocate physical pages single
|
|
||||||
* pages at a time, accomplished by returning single pages
|
|
||||||
* if the caller can handle that (indicated by PAF_FIRSTBLOCK).
|
|
||||||
*/
|
|
||||||
if(memflags & PAF_FIRSTBLOCK) {
|
|
||||||
assert(!(memflags & PAF_CONTIG));
|
|
||||||
pages = 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while((pr = addr_get_iter(&iter))) {
|
while((pr = addr_get_iter(&iter))) {
|
||||||
SLABSANE(pr);
|
SLABSANE(pr);
|
||||||
assert(pr->size > 0);
|
assert(pr->size > 0);
|
||||||
|
@ -921,8 +921,10 @@ struct memlist *alloc_mem_in_list(phys_bytes bytes, u32_t flags)
|
||||||
ml->phys = CLICK2ABS(mem);
|
ml->phys = CLICK2ABS(mem);
|
||||||
ml->length = CLICK2ABS(gotpages);
|
ml->length = CLICK2ABS(gotpages);
|
||||||
ml->next = NULL;);
|
ml->next = NULL;);
|
||||||
if(tail)
|
if(tail) {
|
||||||
tail->next = ml;
|
USE(tail,
|
||||||
|
tail->next = ml;);
|
||||||
|
}
|
||||||
tail = ml;
|
tail = ml;
|
||||||
if(!head)
|
if(!head)
|
||||||
head = ml;
|
head = ml;
|
||||||
|
|
Loading…
Reference in a new issue