2010-01-13 01:02:12

by Jeff Mahoney

[permalink] [raw]
Subject: [patch 2/6] hugetlb: Fix section mismatches

hugetlb_register_node calls hugetlb_sysfs_add_hstate, which is marked with
__init. Since hugetlb_register_node is only called by
hugetlb_register_all_nodes, which in turn is only called by hugetlb_init,
it's safe to mark both of them as __init.

Signed-off-by: Jeff Mahoney <[email protected]>
---
mm/hugetlb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1630,7 +1630,7 @@ void hugetlb_unregister_node(struct node
* hugetlb module exit: unregister hstate attributes from node sysdevs
* that have them.
*/
-static void hugetlb_unregister_all_nodes(void)
+static void __init hugetlb_unregister_all_nodes(void)
{
int nid;

@@ -1650,7 +1650,7 @@ static void hugetlb_unregister_all_nodes
* Register hstate attributes for a single node sysdev.
* No-op if attributes already registered.
*/
-void hugetlb_register_node(struct node *node)
+void __init hugetlb_register_node(struct node *node)
{
struct hstate *h;
struct node_hstate *nhs = &node_hstates[node->sysdev.id];


2010-01-13 09:28:51

by David Rientjes

[permalink] [raw]
Subject: Re: [patch 2/6] hugetlb: Fix section mismatches

On Tue, 12 Jan 2010, Jeff Mahoney wrote:

> hugetlb_register_node calls hugetlb_sysfs_add_hstate, which is marked with
> __init. Since hugetlb_register_node is only called by
> hugetlb_register_all_nodes, which in turn is only called by hugetlb_init,
> it's safe to mark both of them as __init.
>
> Signed-off-by: Jeff Mahoney <[email protected]>
> ---
> mm/hugetlb.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1630,7 +1630,7 @@ void hugetlb_unregister_node(struct node
> * hugetlb module exit: unregister hstate attributes from node sysdevs
> * that have them.
> */
> -static void hugetlb_unregister_all_nodes(void)
> +static void __init hugetlb_unregister_all_nodes(void)
> {
> int nid;
>

This is wrong, you want to move hugetlb_register_all_nodes() to
.init.text, not hugetlb_unregister_all_nodes().

> @@ -1650,7 +1650,7 @@ static void hugetlb_unregister_all_nodes
> * Register hstate attributes for a single node sysdev.
> * No-op if attributes already registered.
> */
> -void hugetlb_register_node(struct node *node)
> +void __init hugetlb_register_node(struct node *node)
> {
> struct hstate *h;
> struct node_hstate *nhs = &node_hstates[node->sysdev.id];

2010-01-13 14:30:39

by Jeff Mahoney

[permalink] [raw]
Subject: Re: [patch 2/6] hugetlb: Fix section mismatches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/13/2010 04:28 AM, David Rientjes wrote:
> On Tue, 12 Jan 2010, Jeff Mahoney wrote:
>
>> hugetlb_register_node calls hugetlb_sysfs_add_hstate, which is marked with
>> __init. Since hugetlb_register_node is only called by
>> hugetlb_register_all_nodes, which in turn is only called by hugetlb_init,
>> it's safe to mark both of them as __init.
>>
>> Signed-off-by: Jeff Mahoney <[email protected]>
>> ---
>> mm/hugetlb.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> --- a/mm/hugetlb.c
>> +++ b/mm/hugetlb.c
>> @@ -1630,7 +1630,7 @@ void hugetlb_unregister_node(struct node
>> * hugetlb module exit: unregister hstate attributes from node sysdevs
>> * that have them.
>> */
>> -static void hugetlb_unregister_all_nodes(void)
>> +static void __init hugetlb_unregister_all_nodes(void)
>> {
>> int nid;
>>
>
> This is wrong, you want to move hugetlb_register_all_nodes() to
> .init.text, not hugetlb_unregister_all_nodes().

Yep. You're right. I had this correct in my initial version of the patch
but accidentally deleted it while renaming them. I'll re-send.

- -Jeff

>> @@ -1650,7 +1650,7 @@ static void hugetlb_unregister_all_nodes
>> * Register hstate attributes for a single node sysdev.
>> * No-op if attributes already registered.
>> */
>> -void hugetlb_register_node(struct node *node)
>> +void __init hugetlb_register_node(struct node *node)
>> {
>> struct hstate *h;
>> struct node_hstate *nhs = &node_hstates[node->sysdev.id];


- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/

iEYEARECAAYFAktN2NsACgkQLPWxlyuTD7LWzACcDpwbTkDEaZpdHUOYBiFqj0xP
9NkAnjoySOmUkV45P8yaMK6Z7N8xWnvn
=dTst
-----END PGP SIGNATURE-----

2010-01-13 15:04:19

by Jeff Mahoney

[permalink] [raw]
Subject: [patch] hugetlb: Fix section mismatches #2

hugetlb_register_node calls hugetlb_sysfs_add_hstate, which is marked with
__init. Since hugetlb_register_node is only called by
hugetlb_register_all_nodes, which in turn is only called by hugetlb_init,
it's safe to mark both of them as __init.

Signed-off-by: Jeff Mahoney <[email protected]>
---
mm/hugetlb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1650,7 +1650,7 @@ static void hugetlb_unregister_all_nodes
* Register hstate attributes for a single node sysdev.
* No-op if attributes already registered.
*/
-void hugetlb_register_node(struct node *node)
+void __init hugetlb_register_node(struct node *node)
{
struct hstate *h;
struct node_hstate *nhs = &node_hstates[node->sysdev.id];
@@ -1683,7 +1683,7 @@ void hugetlb_register_node(struct node *
* sysdevs of nodes that have memory. All on-line nodes should have
* registered their associated sysdev by this time.
*/
-static void hugetlb_register_all_nodes(void)
+static void __init hugetlb_register_all_nodes(void)
{
int nid;

--
Jeff Mahoney
SUSE Labs

2010-01-13 15:40:19

by Lee Schermerhorn

[permalink] [raw]
Subject: Re: [patch 2/6] hugetlb: Fix section mismatches

On Tue, 2010-01-12 at 19:48 -0500, Jeff Mahoney wrote:
> plain text document attachment (patches.rpmify)
> hugetlb_register_node calls hugetlb_sysfs_add_hstate, which is marked with
> __init. Since hugetlb_register_node is only called by
> hugetlb_register_all_nodes, which in turn is only called by hugetlb_init,
> it's safe to mark both of them as __init.

Actually, hugetlb_register_node() also called, via a function pointer
that hugetlb registers with the sysfs node driver, when a node is hot
plugged. So, I think the correct approach is to remove the '__init'
from hugetlb_sysfs_add_hstate() as this is also used at runtime. I
missed this in the original submittal.

Regards,
Lee Schermerhorn

>
> Signed-off-by: Jeff Mahoney <[email protected]>
> ---
> mm/hugetlb.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1630,7 +1630,7 @@ void hugetlb_unregister_node(struct node
> * hugetlb module exit: unregister hstate attributes from node sysdevs
> * that have them.
> */
> -static void hugetlb_unregister_all_nodes(void)
> +static void __init hugetlb_unregister_all_nodes(void)
> {
> int nid;
>
> @@ -1650,7 +1650,7 @@ static void hugetlb_unregister_all_nodes
> * Register hstate attributes for a single node sysdev.
> * No-op if attributes already registered.
> */
> -void hugetlb_register_node(struct node *node)
> +void __init hugetlb_register_node(struct node *node)
> {
> struct hstate *h;
> struct node_hstate *nhs = &node_hstates[node->sysdev.id];
>
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to [email protected]. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

2010-01-13 15:43:05

by Jeff Mahoney

[permalink] [raw]
Subject: Re: [patch 2/6] hugetlb: Fix section mismatches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/13/2010 10:40 AM, Lee Schermerhorn wrote:
> On Tue, 2010-01-12 at 19:48 -0500, Jeff Mahoney wrote:
>> plain text document attachment (patches.rpmify)
>> hugetlb_register_node calls hugetlb_sysfs_add_hstate, which is marked with
>> __init. Since hugetlb_register_node is only called by
>> hugetlb_register_all_nodes, which in turn is only called by hugetlb_init,
>> it's safe to mark both of them as __init.
>
> Actually, hugetlb_register_node() also called, via a function pointer
> that hugetlb registers with the sysfs node driver, when a node is hot
> plugged. So, I think the correct approach is to remove the '__init'
> from hugetlb_sysfs_add_hstate() as this is also used at runtime. I
> missed this in the original submittal.

Yep. You're right. Sorry for the noise.

- -Jeff

> Regards,
> Lee Schermerhorn
>
>>
>> Signed-off-by: Jeff Mahoney <[email protected]>
>> ---
>> mm/hugetlb.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> --- a/mm/hugetlb.c
>> +++ b/mm/hugetlb.c
>> @@ -1630,7 +1630,7 @@ void hugetlb_unregister_node(struct node
>> * hugetlb module exit: unregister hstate attributes from node sysdevs
>> * that have them.
>> */
>> -static void hugetlb_unregister_all_nodes(void)
>> +static void __init hugetlb_unregister_all_nodes(void)
>> {
>> int nid;
>>
>> @@ -1650,7 +1650,7 @@ static void hugetlb_unregister_all_nodes
>> * Register hstate attributes for a single node sysdev.
>> * No-op if attributes already registered.
>> */
>> -void hugetlb_register_node(struct node *node)
>> +void __init hugetlb_register_node(struct node *node)
>> {
>> struct hstate *h;
>> struct node_hstate *nhs = &node_hstates[node->sysdev.id];
>>
>>
>> --
>> To unsubscribe, send a message with 'unsubscribe linux-mm' in
>> the body to [email protected]. For more info on Linux MM,
>> see: http://www.linux-mm.org/ .
>> Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
>


- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/

iEYEARECAAYFAktN6dYACgkQLPWxlyuTD7JzEgCfXZKyPnW9VKO7OTatSm5k5WSI
l6sAoIVB0cTvz1AwN2mG7ANGPt6VVuTi
=TYGp
-----END PGP SIGNATURE-----

2010-01-13 20:51:25

by David Rientjes

[permalink] [raw]
Subject: Re: [patch] hugetlb: Fix section mismatches #2

On Wed, 13 Jan 2010, Jeff Mahoney wrote:

> hugetlb_register_node calls hugetlb_sysfs_add_hstate, which is marked with
> __init. Since hugetlb_register_node is only called by
> hugetlb_register_all_nodes, which in turn is only called by hugetlb_init,
> it's safe to mark both of them as __init.
>
> Signed-off-by: Jeff Mahoney <[email protected]>

Acked-by: David Rientjes <[email protected]>