Re: [Lhms-devel] [RFC] free_area[] bitmap elimination [0/3]

Dave Hansen
2004-08-23T14:36:25Z

On Fri, 2004-08-20 at 19:31, Hiroyuki KAMEZAWA wrote:
> This patch removes bitmap from buddy allocator used in
> alloc_pages()/free_pages() in the kernel 2.6.8.1.

Looks very interesting. The most mysterious thing about it that I can
think of right now would be its cache behavior. Since struct pages are
at least 1/2 a cacheline on most architectures, you're going to dirty
quite a few more cachelines than if you were accessing a quick bitmap.
However, if the page was recently accessed you might get *better*
cacheline performance because the struct page itself may have been
hotter than its bitmap.

The use of page_count()==0 is a little worrisome. There's almost
certainly some race conditions where a page can be mistaken for free
while it's page_count()==0, but before it's reached free_pages_bulk().

BTW, even if page_count()==0 isn't a valid check like you fear, you
could always steal a bit in the page->flags. Check out
free_pages_check() in mm/page_alloc.c for a nice summary of what state
pages have to be in before they're freed.

I'll try and give these patches a run on a NUMA-Q today. Those machines
are very cache-sensitive and should magnify any positive or negative
effects.

-- Dave