nommu: yield CPU periodically while disposing large VM
Subsystems (2)
PATCH 1/1 nommu: yield CPU periodically while disposing large VM
Depending on processor speed, page size, and the amount of memory a process is allowed to amass, cleanup of a large VM may freeze the system for many seconds. This can result in a watchdog timeout.
Make sure other tasks receive some service when cleaning up large VMs.
Signed-off-by Steven J. Magnani <[email protected]>
---
mm/nommu.c +6 -0
@@ -1656,6 +1656,7 @@ SYSCALL_DEFINE2(munmap, unsigned long, avoid exit_mmap (struct mm_struct *mm) {struct vm_area_struct *vma; +unsigned long next_yield = jiffies +HZ ;if (!mm)return ;
@@ -1668,6 +1669,11 @@ void exit_mmap(struct mm_struct *mm) mm->mmap = vma->vm_next;delete_vma_from_mm (vma);delete_vma (mm, vma); +/* Yield periodically to prevent watchdog timeout */ +if (time_after (jiffies, next_yield)) { +cond_resched (); + next_yield = jiffies +HZ ; + } }kleave ("" );
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>