[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120320190055.GZ24602@redhat.com>
Date: Tue, 20 Mar 2012 20:00:55 +0100
From: Andrea Arcangeli <aarcange@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Rik van Riel <riel@...hat.com>, 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>, hughd@...gle.com
Subject: Re: [PATCH -mm 2/2] mm: do not reset mm->free_area_cache on every
single munmap
On Thu, Feb 23, 2012 at 01:56:14PM -0800, Andrew Morton wrote:
> 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?
I intended to implement it a couple of years ago.
It takes a change to the rbtree code so that when rb_erase and
rb_insert_color are called, proper methods are called to notify the
caller that there's been a rotation (probably calling a new
rb_insert_color_with_metadata(&method(left_rot, right_rot)) ). So that
these methods can update the new status of the tree. So you can keep
the "max" hole information for the left and right side of the tree at
the top node, and if the left side of the tree from the top doesn't
have a big enough max hole you take the right immediately (if if fits)
skipping over everything that isn't interesting and you keep doing so
until the max hole on right or left fits the size of the allocation
request (and then you find what you were searching for in vma and
vma->vm_next). It's very tricky but it should be possible. Still it
would remain generic code in rbtree.c, not actually knowing it's the
max hole info we're collecting at the root node for left and right
nodes. Maybe only the left side of the tree max hole needs to be
collected, not having the right size only means a worst case O(log(N))
walk on the tree (taking ->right all the time 'till the leaf) so it'd
be perfectly ok and it may simplify things a lot having only the max
hole on the left.
I'm too busy optimizing AutoNUMA even further to delve into this but I
hope somebody implements it. I thought about exactly this when I've
seen these patches floating around, so I'm glad you mentioned it.
--
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