mm: Fix section mismatch in memcontrol.c
Subsystems (2)
PATCH 1/1 mm: Fix section mismatch in memcontrol.c
Impact: Fix section mismatch warning.
The annotation for __init in enable_swap_cgroup() and __initdata for really_do_swap_account produces the following warning. Which is not right, since this function is called from non-init section. This patch fixes it. If anything else please notice.
LD mm/built-in.o
WARNING: mm/built-in.o(.text+0x277d9): Section mismatch in reference from the function mem_cgroup_create() to the function .init.text:enable_swap_cgroup()
The function mem_cgroup_create() references
the function __init enable_swap_cgroup().
This is often because mem_cgroup_create lacks a __init annotation or the annotation of enable_swap_cgroup is wrong.
mm/memcontrol.c +0 -0
@@ -46,7 +46,7 @@ struct cgroup_subsys mem_cgroup_subsys _#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP /* Turned on only when memory cgroup is enabled &&
really_do_swap_account = 0 */
int do_swap_account __read_mostly;
-static int really_do_swap_account __initdata = 1; /* for remember boot option*/ +static int really_do_swap_account = 1; /* for remember boot option*/
#else
#define do_swap_account (0)
#endif
@@ -2170,13 +2170,13 @@ static void mem_cgroup_put(struct mem_cg
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
-static void __init enable_swap_cgroup(void) +static void enable_swap_cgroup(void)
{
if (!mem_cgroup_disabled() && really_do_swap_account)
do_swap_account = 1;
}
#else
-static void __init enable_swap_cgroup(void) +static void enable_swap_cgroup(void)
{
}
#endif
Quoted 7 lines · Rakib Mullick
Impact: Fix section mismatch warning.
The annotation for
__initinenable_swap_cgroup()and__initdataforreally_do_swap_accountproduces the following warning. Which is not right, since this function is called from non-init section. This patch fixes it. If anything else please notice.
I saw this warning on IA64. But this fix is wrong IMO.
enable_swap_cgroup() will be called at system boot only:
start_kernel()
cgroup_init()
mem_cgroup_create()
enable_swap_cgroup()
I think the proper fix is annotate mem_cgroup_create() with __init_refok.
Quoted 40 lines
LD
mm/built-in.o
WARNING: mm/built-in.o(.text+0x277d9): Section mismatch in reference from the functionmem_cgroup_create()to the function .init.text:enable_swap_cgroup()
The functionmem_cgroup_create()references
the function__initenable_swap_cgroup().
This is often becausemem_cgroup_createlacks a__initannotation or the annotation ofenable_swap_cgroupis wrong.Signed-off-by Rakib Mullick <[email protected]>mm/memcontrol.c +0
-0@@ -46,7 +46,7 @@ struct cgroup_subsys mem_cgroup_subsys _#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP /* Turned on only when memory cgroup is enabled &&
really_do_swap_account= 0 */
intdo_swap_account__read_mostly;mm/memcontrol.c +3
-4-static int really_do_swap_account__initdata =1 ;/* for remember boot option*/ +static int really_do_swap_account =1 ;/* for remember boot option*/ #else #define do_swap_account (0)#endif @@ -2170,13 +2170,13 @@ static void mem_cgroup_put(struct mem_cg#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP -static void __init enable_swap_cgroup (void ) +static void enable_swap_cgroup (void ) {if (!mem_cgroup_disabled () && really_do_swap_account) do_swap_account =1 ; }#else -static void __init enable_swap_cgroup (void ) +static void enable_swap_cgroup (void ) { }#endif --
Quoted 14 lines · On Tue, 13 Jan 2009 13:49:03 +0800 Li Zefan <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>Cc Balbir Singh <[email protected]>Quoted 7 lines · Rakib Mullick
Impact: Fix section mismatch warning.
The annotation for
__initinenable_swap_cgroup()and__initdataforreally_do_swap_accountproduces the following warning. Which is not right, since this function is called from non-init section. This patch fixes it. If anything else please notice.I saw this warning on IA64. But this fix is wrong IMO.
Quoted 9 lines
enable_swap_cgroup()will be called at system boot only:
start_kernel()
cgroup_init()
mem_cgroup_create()
enable_swap_cgroup()I think the proper fix is annotate
mem_cgroup_create()with__init_refok.
I think Li Zefan's fix is correct.
Could you make a patch ? or I'll schedule this as my work.
Thanks,
-Kame
Sure. You can carryout your other jobs. Here is the patch. Thanks for your help guys.
mm/memcontrol.c +2 -2
@@ -2170,13 +2170,13 @@ static void mem_cgroup_put(struct mem_cg#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP -static void __init enable_swap_cgroup (void ) +static void __init_refok enable_swap_cgroup(void) {if (!mem_cgroup_disabled () && really_do_swap_account) do_swap_account =1 ; }#else -static void __init enable_swap_cgroup (void ) +static void __init_refok enable_swap_cgroup(void) { }#endif
Quoted 34 lines · KAMEZAWA Hiroyuki
Quoted 14 lines · On Tue, 13 Jan 2009 13:49:03 +0800 Li Zefan <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>Cc Balbir Singh <[email protected]>Quoted 7 lines · Rakib Mullick
Impact: Fix section mismatch warning.
The annotation for
__initinenable_swap_cgroup()and__initdataforreally_do_swap_accountproduces the following warning. Which is not right, since this function is called from non-init section. This patch fixes it. If anything else please notice.I saw this warning on IA64. But this fix is wrong IMO.
Quoted 9 lines
enable_swap_cgroup()will be called at system boot only:
start_kernel()
cgroup_init()
mem_cgroup_create()
enable_swap_cgroup()I think the proper fix is annotate
mem_cgroup_create()with__init_refok.I think Li Zefan's fix is correct.
Could you make a patch ? or I'll schedule this as my work.Thanks,
-Kame
KAMEZAWA Hiroyuki
Acked-byQuoted 3 lines · On Wed, 14 Jan 2009 10:43:24 +0600 "Rakib Mullick" <[email protected]>…
Sure. You can carryout your other jobs. Here is the patch. Thanks for your help guys.
Thank you. I confirmed this fixes mismatch.
Could you send this with your Signed-off-by, again ?
you got my Ack.
Quoted 56 lines
mm/memcontrol.c +2
-2@@ -2170,13 +2170,13 @@ static void mem_cgroup_put(struct mem_cg#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP -static void __init enable_swap_cgroup (void ) +static void __init_refok enable_swap_cgroup(void) {if (!mem_cgroup_disabled () && really_do_swap_account) do_swap_account =1 ; }#else -static void __init enable_swap_cgroup (void ) +static void __init_refok enable_swap_cgroup(void) { }#endif Quoted 34 lines · KAMEZAWA Hiroyuki
Quoted 14 lines · On Tue, 13 Jan 2009 13:49:03 +0800 Li Zefan <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>Cc Balbir Singh <[email protected]>Quoted 7 lines · Rakib Mullick
Impact: Fix section mismatch warning.
The annotation for
__initinenable_swap_cgroup()and__initdataforreally_do_swap_accountproduces the following warning. Which is not right, since this function is called from non-init section. This patch fixes it. If anything else please notice.I saw this warning on IA64. But this fix is wrong IMO.
Quoted 9 lines
enable_swap_cgroup()will be called at system boot only:
start_kernel()
cgroup_init()
mem_cgroup_create()
enable_swap_cgroup()I think the proper fix is annotate
mem_cgroup_create()with__init_refok.I think Li Zefan's fix is correct.
Could you make a patch ? or I'll schedule this as my work.Thanks,
-Kame
Oh, yes. I forgot to signed off the patch. Here it is.
mm/memcontrol.c +2 -2
@@ -2170,13 +2170,13 @@ static void mem_cgroup_put(struct mem_cg#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP -static void __init enable_swap_cgroup (void ) +static void __init_refok enable_swap_cgroup(void) {if (!mem_cgroup_disabled () && really_do_swap_account) do_swap_account =1 ; }#else -static void __init enable_swap_cgroup (void ) +static void __init_refok enable_swap_cgroup(void) { }#endif
Quoted 75 lines · KAMEZAWA Hiroyuki
Quoted 3 lines · On Wed, 14 Jan 2009 10:43:24 +0600 "Rakib Mullick" <[email protected]>…
Sure. You can carryout your other jobs. Here is the patch. Thanks for your help guys.
Thank you. I confirmed this fixes mismatch.
Could you send this with your Signed-off-by, again ?
you got my Ack.
Quoted 58 lines
mm/memcontrol.c +2
-2@@ -2170,13 +2170,13 @@ static void mem_cgroup_put(struct mem_cg#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP -static void __init enable_swap_cgroup (void ) +static void __init_refok enable_swap_cgroup(void) {if (!mem_cgroup_disabled () && really_do_swap_account) do_swap_account =1 ; }#else -static void __init enable_swap_cgroup (void ) +static void __init_refok enable_swap_cgroup(void) { }#endif Quoted 36 lines · KAMEZAWA Hiroyuki
Quoted 17 lines · On Tue, 13 Jan 2009 13:49:03 +0800 Li Zefan <[email protected]> wrote:
Cc KAMEZAWA Hiroyuki <[email protected]>Cc Balbir Singh <[email protected]>Quoted 8 lines · Rakib Mullick
Impact: Fix section mismatch warning.
The annotation for
__initinenable_swap_cgroup()and__initdataforreally_do_swap_accountproduces the following warning. Which is not right, since this function is called from non-init section. This patch
fixes it. If anything else please notice.I saw this warning on IA64. But this fix is wrong IMO.
enable_swap_cgroup()will be called at system boot only:Quoted 8 lines
start_kernel()
cgroup_init()
mem_cgroup_create()
enable_swap_cgroup()I think the proper fix is annotate
mem_cgroup_create()with__init_refok.I think Li Zefan's fix is correct.
Could you make a patch ? or I'll schedule this as my work.Thanks,
-Kame
Quoted 6 lines · KAMEZAWA Hiroyuki
Quoted 3 lines · On Wed, 14 Jan 2009 10:43:24 +0600 "Rakib Mullick" <[email protected]>…
Sure. You can carryout your other jobs. Here is the patch. Thanks for your help guys.
Quoted 7 lines
Thank you. I confirmed this fixes mismatch.
Could you send this with your Signed-off-by, again ?
you got my Ack.
No... This patch is still not correct..
It's mem_cgroup_create() but not enable_swap_cgroup() that needs to be marked as __init_refok.
Here is the correct one:
===============
From: Li Zefan <[email protected]>
Date: Wed, 14 Jan 2009 13:07:31 +0800
Subject: [PATCH] memcg: fix section mismatch
At system boot when creating the top cgroup, mem_cgroup_create() calls enable_swap_cgroup() which is marked as __init, so mark mem_cgroup_create() as __init_refok to avoid false section mismatch warning.
--- mm/memcontrol.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
mm/memcontrol.c +1 -1
@@ -2181,7 +2181,7 @@ static void __init enable_swap_cgroup(void) }#endif -static struct cgroup_subsys_state * +static struct cgroup_subsys_state * __init_refokmem_cgroup_create (struct cgroup_subsys *ss,struct cgroup *cont) {struct mem_cgroup *mem, *parent;
Signature · 1 line
1.5.4.rc3
Quoted 15 lines · On Wed, 14 Jan 2009 13:14:54 +0800 Li Zefan <[email protected]> wrote:
Quoted 6 lines · KAMEZAWA Hiroyuki
Quoted 3 lines · On Wed, 14 Jan 2009 10:43:24 +0600 "Rakib Mullick" <[email protected]>…
Sure. You can carryout your other jobs. Here is the patch. Thanks for your help guys.
Quoted 7 lines
Thank you. I confirmed this fixes mismatch.
Could you send this with your Signed-off-by, again ?
you got my Ack.
Quoted 7 lines
No... This patch is still not correct..
It's
mem_cgroup_create()but notenable_swap_cgroup()that needs to be marked as__init_refok.Here is the correct one:
Ah..maybe you're right.
BTW, reading inclinde/linux/init.h again
==
/* modpost check for section mismatches during the kernel build.
* A section mismatch happens when there are references from a
* code or data section to an init section (both code or data).
* The init sections are (for most archs) discarded by the kernel
* when early init has completed so all such references are potential bugs.
* For exit sections the same issue exists.
* The following markers are used for the cases where the reference to
* the *init / *exit section (code or data) is valid and will teach
* modpost not to issue a warning.
* The markers follow same syntax rules as __init / __initdata. */
#define __ref __section(.ref.text) noinline #define __refdata __section(.ref.data) #define __refconst __section(.ref.rodata)
==
It seems init_refok is old style.
Could you convert to __ref ?
-Kame
Quoted 37 lines
===============
From: Li Zefan <[email protected]>
Date: Wed, 14 Jan 2009 13:07:31 +0800
Subject: [PATCH] memcg: fix section mismatchAt system boot when creating the top cgroup,
mem_cgroup_create()callsenable_swap_cgroup()which is marked as__init, so markmem_cgroup_create()as__init_refokto avoid false section mismatch warning.Reported-by Rakib Mullick <[email protected]>Signed-off-by Li Zefan <[email protected]>--- mm/memcontrol.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)mm/memcontrol.c +1
-1@@ -2181,7 +2181,7 @@ static void __init enable_swap_cgroup(void) }#endif -static struct cgroup_subsys_state * +static struct cgroup_subsys_state * __init_refokmem_cgroup_create (struct cgroup_subsys *ss,struct cgroup *cont) {struct mem_cgroup *mem, *parent;Signature · 6 lines
1.5.4.rc3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/