On Fri, Oct 30, 2015 at 01:17:54PM -0700, Andi Kleen wrote: > 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? Yep, the zap_pmd_range() has cond_resched(). > 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. that would not work if the app madvise(DONTNEED) first and then access the virtual address again. Thanks, Shaohua -- 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>