Implement i386/i386/pmap.c 1.292 for alpha, ia64 (avoid free
page exhaustion / kernel panic for certain madvise() scenarios)
This commit is contained in:
parent
2899d60638
commit
5d339e3d47
@ -2466,7 +2466,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
|
|||||||
psize = alpha_btop(size);
|
psize = alpha_btop(size);
|
||||||
|
|
||||||
if ((object->type != OBJT_VNODE) ||
|
if ((object->type != OBJT_VNODE) ||
|
||||||
(limit && (psize > MAX_INIT_PT) &&
|
((limit & MAP_PREFAULT_PARTIAL) && (psize > MAX_INIT_PT) &&
|
||||||
(object->resident_page_count > MAX_INIT_PT))) {
|
(object->resident_page_count > MAX_INIT_PT))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2494,6 +2494,14 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
|
|||||||
if (tmpidx >= psize) {
|
if (tmpidx >= psize) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* don't allow an madvise to blow away our really
|
||||||
|
* free pages allocating pv entries.
|
||||||
|
*/
|
||||||
|
if ((limit & MAP_PREFAULT_MADVISE) &&
|
||||||
|
cnt.v_free_count < cnt.v_free_reserved) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
|
if (((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
|
||||||
(p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
|
(p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
|
||||||
if ((p->queue - p->pc) == PQ_CACHE)
|
if ((p->queue - p->pc) == PQ_CACHE)
|
||||||
@ -2511,6 +2519,14 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
|
|||||||
* else lookup the pages one-by-one.
|
* else lookup the pages one-by-one.
|
||||||
*/
|
*/
|
||||||
for (tmpidx = 0; tmpidx < psize; tmpidx += 1) {
|
for (tmpidx = 0; tmpidx < psize; tmpidx += 1) {
|
||||||
|
/*
|
||||||
|
* don't allow an madvise to blow away our really
|
||||||
|
* free pages allocating pv entries.
|
||||||
|
*/
|
||||||
|
if ((limit & MAP_PREFAULT_MADVISE) &&
|
||||||
|
cnt.v_free_count < cnt.v_free_reserved) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
p = vm_page_lookup(object, tmpidx + pindex);
|
p = vm_page_lookup(object, tmpidx + pindex);
|
||||||
if (p &&
|
if (p &&
|
||||||
((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
|
((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
|
||||||
|
@ -1743,7 +1743,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
|
|||||||
psize = ia64_btop(size);
|
psize = ia64_btop(size);
|
||||||
|
|
||||||
if ((object->type != OBJT_VNODE) ||
|
if ((object->type != OBJT_VNODE) ||
|
||||||
(limit && (psize > MAX_INIT_PT) &&
|
((limit & MAP_PREFAULT_PARTIAL) && (psize > MAX_INIT_PT) &&
|
||||||
(object->resident_page_count > MAX_INIT_PT))) {
|
(object->resident_page_count > MAX_INIT_PT))) {
|
||||||
pmap_install(oldpmap);
|
pmap_install(oldpmap);
|
||||||
return;
|
return;
|
||||||
@ -1771,6 +1771,14 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
|
|||||||
if (tmpidx >= psize) {
|
if (tmpidx >= psize) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* don't allow an madvise to blow away our really
|
||||||
|
* free pages allocating pv entries.
|
||||||
|
*/
|
||||||
|
if ((limit & MAP_PREFAULT_MADVISE) &&
|
||||||
|
cnt.v_free_count < cnt.v_free_reserved) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
|
if (((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
|
||||||
(p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
|
(p->flags & (PG_BUSY | PG_FICTITIOUS)) == 0) {
|
||||||
if ((p->queue - p->pc) == PQ_CACHE)
|
if ((p->queue - p->pc) == PQ_CACHE)
|
||||||
@ -1788,6 +1796,14 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,
|
|||||||
* else lookup the pages one-by-one.
|
* else lookup the pages one-by-one.
|
||||||
*/
|
*/
|
||||||
for (tmpidx = 0; tmpidx < psize; tmpidx += 1) {
|
for (tmpidx = 0; tmpidx < psize; tmpidx += 1) {
|
||||||
|
/*
|
||||||
|
* don't allow an madvise to blow away our really
|
||||||
|
* free pages allocating pv entries.
|
||||||
|
*/
|
||||||
|
if ((limit & MAP_PREFAULT_MADVISE) &&
|
||||||
|
cnt.v_free_count < cnt.v_free_reserved) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
p = vm_page_lookup(object, tmpidx + pindex);
|
p = vm_page_lookup(object, tmpidx + pindex);
|
||||||
if (p &&
|
if (p &&
|
||||||
((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
|
((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user