lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1236359888.3882.77.camel@pc1117.cambridge.arm.com>
Date:	Fri, 06 Mar 2009 17:18:08 +0000
From:	Catalin Marinas <catalin.marinas@....com>
To:	Dave Hansen <dave@...ux.vnet.ibm.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 Fri, 2009-03-06 at 08:52 -0800, Dave Hansen wrote:
> On Fri, 2009-03-06 at 16:40 +0000, Catalin Marinas wrote:
> > It seems that node_start_pfn() isn't present on all the architectures. I
> > ended up with something like below:
> > 
> > +	/* struct page scanning for each node */
> > +	for_each_online_node(i) {
> > +		pg_data_t *pgdat = NODE_DATA(i);
> > +		unsigned long start_pfn = pgdat->node_start_pfn;
> > +		unsigned long end_pfn = start_pfn +
> > +			pgdat->node_spanned_pages - 1;
> > +		unsigned long pfn;
> > +
> > +		for (pfn = start_pfn; pfn < end_pfn; pfn++) {
> > +			struct page *page;
> > +
> > +			if (!pfn_valid(pfn))
> > +				continue;
> > +			page = pfn_to_page(pfn);
> > +			/* only scan if page is in use */
> > +			if (page_count(page) == 0)
> > +				continue;
> > +			scan_block(page, page + 1, NULL);
> > +		}
> > +	}
> 
> What does scan_block() actually scan?  Is that second argument
> inclusive?

No, it's exclusive. In the above case, it just scans a struct page at
the given pointer.

> I think you will miss scanning the contents of the last 'struct page' if
> you do it this way because of the -1 you do to end_pfn.

Fixed.

> > 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.

-- 
Catalin

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ