Re: [PATCH] low-latency zap_page_range

Andrew Morton
2002-07-22T05:03:26Z

Robert Love wrote:
>
> The lock hold time in zap_page_range is horrid.
>

Yes, it is. And although our mandate is to fix things
like this without grafted-on low latency hacks, zap_page_range()
may be one case where simply popping the lock is the best solution.
Not sure.

> ...
> + while (size) {
> + block = (size > ZAP_BLOCK_SIZE) ? ZAP_BLOCK_SIZE : size;
> + end = address + block;
> +
> + spin_lock(&mm->page_table_lock);
> +
> + flush_cache_range(vma, address, end);
> + tlb = tlb_gather_mmu(mm, 0);
> + unmap_page_range(tlb, vma, address, end);
> + tlb_finish_mmu(tlb, address, end);
> +
> + spin_unlock(&mm->page_table_lock);
> +
> + address += block;
> + size -= block;
> + }

This adds probably-unneeded extra work - we shouldn't go
dropping the lock unless that is actually required. ie:
poll ->need_resched first. Possible?

-