Messages in this thread | | | Subject | Re: Regression - locking (all from 2.6.28) | From | Catalin Marinas <> | Date | Fri, 06 Mar 2009 18:00:36 +0000 |
| |
On Fri, 2009-03-06 at 09:26 -0800, Dave Hansen wrote: > On Fri, 2009-03-06 at 17:18 +0000, Catalin Marinas wrote: > > > > Are the pgdat->node_start_pfn and pgdat->node_spanned_pages always > > > > valid? Thanks. > > > > > > The variables themselves? I'm sure there's a window in early boot where > > > they aren't valid, but other than that they should be OK unless you're > > > int the middle of a hotplug operation. > > > > > > See pgdat_resize_(un)lock() in include/linux/memory_hotplug.h. > > > > I wouldn't hold a lock for that long. It's not really critical to scan > > all the page structures at a time as there are subsequent scans as well, > > so some can be missed. > > I think you should be more worried about consistency rather than missing > entries. Take these two lines of code: > > start_pfn = node->node_start_pfn; > /* hotplug occurs here */ > end_pfn = start_pfn + node->node_spanned_pages; > > What if someone comes in and adds memory to the node, at the beginning > of the node, after you have calculated start_pfn? Try to think of what > value you'll get for end_pfn and whether it is consistent and was *ever* > valid at all. Would that oops the kernel?
I assume pfn_valid() should handle this and kmemleak wouldn't scan the page, unless we need locks around pfn_valid as well but I haven't seen any used in the kernel.
-- Catalin
| |