Shaohua Li <shli@xxxxxx> writes: > + vmas[i] = find_vma(current->mm, start); > + /* > + * don't allow range cross vma, it doesn't make sense for > + * DONTNEED > + */ > + if (!vmas[i] || start < vmas[i]->vm_start || > + start + len > vmas[i]->vm_end) { > + error = -ENOMEM; > + goto up_out; > + } > + if (vmas[i]->vm_flags & (VM_LOCKED|VM_HUGETLB|VM_PFNMAP)) { > + error = -EINVAL; > + goto up_out; > + } > + } Needs a cond_resched() somewhere in case the list is very long? BTW one trick that may be interesting here is to add a new mode that skips the TLB flush completely, but instead waits with the freeing until enough context switches to non kernel tasks occurred (and flushed the TLB this way). This could be done as part of RCU. -Andi -- ak@xxxxxxxxxxxxxxx -- Speaking for myself only -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>