[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120223135614.7c4e02db.akpm@linux-foundation.org>
Date: Thu, 23 Feb 2012 13:56:14 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Rik van Riel <riel@...hat.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Mel Gorman <mel@....ul.ie>,
Johannes Weiner <hannes@...xchg.org>,
KOSAKI Motohiro <kosaki.motohiro@...il.com>,
Andrea Arcangeli <aarcange@...hat.com>, hughd@...gle.com
Subject: Re: [PATCH -mm 2/2] mm: do not reset mm->free_area_cache on every
single munmap
On Thu, 23 Feb 2012 15:00:34 -0500
Rik van Riel <riel@...hat.com> wrote:
> Some programs have a large number of VMAs, and make frequent calls
> to mmap and munmap. Having munmap constantly cause the search
> pointer for get_unmapped_area to get reset can cause a significant
> slowdown for such programs.
>
> Likewise, starting all the way from the top any time we mmap a small
> VMA can greatly increase the amount of time spent in
> arch_get_unmapped_area_topdown.
>
> For programs with many VMAs, a next-fit algorithm would be fastest,
> however that could waste a lot of virtual address space, and potentially
> page table memory.
>
> A compromise is to reset the search pointer for get_unmapped_area
> after we have unmapped 1/8th of the normal memory in a process.
ick!
> For
> a process with 1000 similar sized VMAs, that means the search pointer
> will only be reset once every 125 or so munmaps. The cost is that
> the program may use about 1/8th more virtual space for these VMAs,
> and up to 1/8th more page tables.
>
> We do not count special mappings, since there are programs that
> use a large fraction of their address space mapping device memory,
> etc.
>
> The benefit is that things scale a lot better, and we remove about
> 200 lines of code.
We've been playing whack-a-mole with this search for many years. What
about developing a proper data structure with which to locate a
suitable-sized hole in O(log(N)) time?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists