Re: + hugetlb-fix-section-mismatch-warning-in-hugetlbc.patch addedto -mm tree

From: Lee Schermerhorn
Date: Fri Jan 08 2010 - 09:06:43 EST


On Fri, 2010-01-08 at 12:34 +0600, Rakib Mullick wrote:
> On 1/8/10, Randy Dunlap <randy.dunlap@xxxxxxxxxx> wrote:
>
> Hi,
> >
> > Hi,
> >
> > If so, then hugetlb_register_node() could be called at any time
> > (like after system init), and it would then call
> > hugetlb_sysfs_add_hstate(), which would be bad.
> >
> But - hugetlb_register_node is only called from hugetlb_register_all_nodes.

No, hugetlb_register_node() is also called from the similarly named
function in drivers/base/node.c. mm/hugetlb.c registers its version of
"hugetlb_register_node()" at start up for use at node hotplug. See
register_hugetlbfs_with_node() in node.c and its use in hugetlb.c.

We had to do it this way because node.c is part of the base kernel and
hugetlb support can be built as a module. All sysfs node kobjs have
been registered by the time hugetlb inits, so hugetlb registers the
nodes' hstate attributes when it initializes. However, when a node is
hotplugged later, the node driver calls into hugetlb to register the
attributes.

So, we need to keep mm/hugetlb.c:hugetlb_register_node() around during
run time when mem/node hot-plug is supported.

Lee


> The call sequence is :
> hugetlb_init ---------------> was __init
> \-> hugetlb_register_all_nodes ----> we make it __init
> \-> hugetlb_register_node
> ---> we make it __init
> \->
> hugetlb_sysfs_add_hstate -> this was __init
>
> Above all happens in __init context. So - hugetlb_register_node is
> called only at
> system init. But I don't think __init is used for hotplug support, for
> proper hotplug
> support we might use __meminit.
>
> And register_hugetlbfs_with_node is called from hugetlb_un/register_node.
> But hugetlb_unregister_node doesn't use callback function. It's not referencing
> hugetlb_sysfs_add_hstate(). So - it's safe. Unless I'm not missing
> anything, too.
>
> thanks,
>
> > Thanks.
> > ---
> >
> > ~Randy
> >
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@xxxxxxxxxx For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/