[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1236214452.22399.68.camel@nimitz>
Date: Wed, 04 Mar 2009 16:54:12 -0800
From: Dave Hansen <dave@...ux.vnet.ibm.com>
To: Catalin Marinas <catalin.marinas@....com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
jan sonnek <ha2nny@...il.com>, linux-kernel@...r.kernel.org,
viro@...iv.linux.org.uk, Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Andy Whitcroft <apw@...dowen.org>
Subject: Re: Regression - locking (all from 2.6.28)
On Tue, 2009-03-03 at 15:01 +0000, Catalin Marinas wrote:
> > + /* mem_map scanning */
> > + for_each_online_node(i) {
> > + struct page *page, *end;
> > +
> > + page = NODE_MEM_MAP(i);
> > + end = page + NODE_DATA(i)->node_spanned_pages;
> > +
> > + scan_block(page, end, NULL);
> > + }
> >
> > The alternative is to inform kmemleak about the page structures returned
> > from __alloc_pages_internal() but there would be problems with recursive
> > calls into kmemleak when it allocates its own data structures.
> >
> > I'll look at re-adding the hunk above, maybe with some extra checks like
> > pfn_valid().
>
> Looking again at this, the node_mem_map is always contiguous and the
> code above only scans the node_mem_map, not the memory represented by
> the node (which may not be contiguous). So I think it is a valid code
> sequence.
The above is *not* a valid code sequence.
It is valid with discontig, but isn't valid for sparsemem. You simply
can't expect to do math on 'struct page' pointers for any granularity
larger than MAX_ORDER_NR_PAGES.
Also, we don't even define NODE_MEM_MAP() for all configurations so that
code snippet won't even compile. We would be smart to kill that macro.
One completely unoptimized thing you can do which will scan a 'struct
page' at a time is this:
for_each_online_node(i) {
unsigned long pfn;
for (pfn = node_start_pfn(i); pfn < node_end_pfn(i); pfn++) {
struct page *page;
if (!pfn_valid(pfn))
continue;
page = pfn_to_page(pfn);
scan_block(page, page+1, NULL);
}
}
The way to optimize it would be to call scan_block() only once for each
MAX_ORDER_NR_PAGES that you encounter. The other option would be to use
the active_regions functions to walk the memory.
Is there a requirement to reduce the number of calls to scan_block()
here?
-- Dave
--
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