Re: munmap extremely slow even with untouched mapping.
From: Hugh Dickins
Date: Fri Oct 28 2005 - 10:23:10 EST
On Fri, 28 Oct 2005, Nick Piggin wrote:
> Robin Holt wrote:
> > I noticed that on ia64, the following simple program would take 24
> > seconds to complete. Profiling revealed I was spending all that time
> > in unmap_vmas. Looking over the function, I noticed that I would only
> > attempt 8 pages at a time (CONFIG_PREMPT). I then thought through this
> > some more. My particular application had one large mapping which was
> > never touched after being mmaped.
> Ouch. I wonder why nobody's noticed this before. It really is
> horribly inefficient on sparse mappings, as you've noticed :(
Yes, it's a good observation from Robin.
It'll have been spoiling the exit speedup we expected from your
2.6.14 copy_page_range "Don't copy [faultable] ptes" fork speedup.
> I guess I prefer the following (compiled, untested) slight
> variant of your patch. Measuring work in terms of address range
> is fairly vague.... however, it may be the case that some
> architectures take a long time to flush a large range of TLBs?
I prefer your patch too. But I'm not very interested in temporary
speedups relative to 2.6.14. Attacking this is a job I'd put off
until after the page fault scalability changes, which make it much
easier to do a proper job.
But I'm still mulling over precisely what that proper job is.
Probably we allocate a buffer (with fallback of course) for the
page pointers, instead of using the per-cpu mmu_gather.
The point being, the reason for ZAP_BLOCK_SIZE, and its low value
when CONFIG_PREEMPT, is that zap_pte_range is liable to build up a
head of work (TLB flushing, swap freeing, page freeing) that had to
be done with preemption still disabled. I'm aiming to do it with
with preemption enabled, and proper "do we need to break now?"
tests within zap_pte_range.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/