Re: [PATCH] Fix sparsemem on Cell

Andrew Morton
2006-12-15T19:45:36Z

On Fri, 15 Dec 2006 09:24:00 -0800
Dave Hansen <haveblue@us.ibm.com> wrote:

>
> ...
>
> I think the comments added say it pretty well, but I'll repeat it here.
>
> This fix is pretty similar in concept to the one that Arnd posted
> as a temporary workaround, but I've added a few comments explaining
> what the actual assumptions are, and improved it a wee little bit.
>
> The end goal here is to simply avoid calling the early_*() functions
> when it is _not_ early. Those functions stop working as soon as
> free_initmem() is called. system_state is set to SYSTEM_RUNNING
> just after free_initmem() is called, so it seems appropriate to use
> here.

Would really prefer not to do this. system_state is evil. Its semantics
are poorly-defined and if someone changes them a bit, or changes memory
initialisation order, you get whacked.

I think an mm-private flag with /*documented*/ semantics would be better.
It's only a byte.

> +static int __meminit can_online_pfn_into_nid(unsigned long pfn, int nid)

I spent some time trying to work out what "can_online_pfn_into_nid" can
possibly mean and failed. "We can bring a pfn online then turn it into a
NID"? Don't think so. "We can bring this page online and allocate it to
this node"? Maybe.

Perhaps if the function's role in the world was commented it would be clearer.