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: <20150427154333.85a1fd2dbc38c7c0888fd4f5@linux-foundation.org>
Date:	Mon, 27 Apr 2015 15:43:33 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Mel Gorman <mgorman@...e.de>
Cc:	Linux-MM <linux-mm@...ck.org>, Nathan Zimmer <nzimmer@....com>,
	Dave Hansen <dave.hansen@...el.com>,
	Waiman Long <waiman.long@...com>,
	Scott Norton <scott.norton@...com>,
	Daniel J Blueman <daniel@...ascale.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 05/13] mm: meminit: Make __early_pfn_to_nid SMP-safe and
 introduce meminit_pfn_in_nid

On Thu, 23 Apr 2015 11:33:08 +0100 Mel Gorman <mgorman@...e.de> wrote:

> __early_pfn_to_nid() in the generic and arch-specific implementations
> use static variables to cache recent lookups. Without the cache
> boot times are much higher due to the excessive memblock lookups but
> it assumes that memory initialisation is single-threaded. Parallel
> initialisation of struct pages will break that assumption so this patch
> makes __early_pfn_to_nid() SMP-safe by requiring the caller to cache
> recent search information. early_pfn_to_nid() keeps the same interface
> but is only safe to use early in boot due to the use of a global static
> variable. meminit_pfn_in_nid() is an SMP-safe version that callers must
> maintain their own state for.

Seems a bit awkward.

> +struct __meminitdata mminit_pfnnid_cache global_init_state;
> +
> +/* Only safe to use early in boot when initialisation is single-threaded */
>  int __meminit early_pfn_to_nid(unsigned long pfn)
>  {
>  	int nid;
>  
> -	nid = __early_pfn_to_nid(pfn);
> +	/* The system will behave unpredictably otherwise */
> +	BUG_ON(system_state != SYSTEM_BOOTING);

Because of this.

Providing a cache per cpu:

struct __meminitdata mminit_pfnnid_cache global_init_state[NR_CPUS];

would be simpler?


Also, `global_init_state' is a poor name for a kernel-wide symbol.

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