mem_init_done (was: Re: [PATCH] [POWERPC] Limit range of __init_ref_ok somewhat)
From: Geert Uytterhoeven <hidden>
Date: 2007-10-02 11:42:13
On Tue, 2 Oct 2007, Stephen Rothwell wrote:
+void * __init_refok zalloc_maybe_bootmem(size_t size, gfp_t mask)
+{
+ void *p;
+
+ if (mem_init_done)
+ p = kzalloc(size, mask);
+ else {
+ p = alloc_bootmem(size);
+ if (p)
+ memset(p, 0, size);
+ }
+ return p;
+}BTW, is this `mem_init_done' flag the recommended(TM) way to handle this? Or is it just something that always stayed under the radar of the reviewers, as only PPC has it (and Atari)? I remember we had something similar globally when __init was introduced, which was used by the frame buffer code to determine whether to draw the penguin logo (which is __initdata) or not. This code had to be ripped out (and was replaced by the FBINFO_MODULE logic), because people didn't like mem_init_done flags... With kind regards, Geert Uytterhoeven Software Architect Sony Network and Software Technology Center Europe The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium Phone: +32 (0)2 700 8453 Fax: +32 (0)2 700 8622 E-mail: Geert.Uytterhoeven@sonycom.com Internet: http://www.sony-europe.com/ Sony Network and Software Technology Center Europe A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 0413.825.160 · RPR Brussels Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619