public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix section mismatch
@ 2007-05-11 15:35 Bernhard Walle
  2007-05-11 17:57 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Bernhard Walle @ 2007-05-11 15:35 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

This patch fixes following compile warning:

--------- >8 --------
WARNING: mm/built-in.o - Section mismatch: reference to .init.text: from .text
between 'kmem_cache_create' (at offset 0x2167b) and 'drain_alien_cache'

WARNING: mm/built-in.o - Section mismatch: reference to .init.text: from .text
between 'kmem_cache_create' (at offset 0x216c1) and 'drain_alien_cache'
--------- 8< --------

set_up_list3s() can be called from setup_cpu_cache() [mm/slab.c] which is not
an init function.


Signed-off-by: Bernhard Walle <bwalle@suse.de>

---
 mm/slab.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/mm/slab.c
+++ b/mm/slab.c
@@ -305,7 +305,7 @@ struct kmem_list3 {
  * Need this for bootstrapping a per node allocator.
  */
 #define NUM_INIT_LISTS (2 * MAX_NUMNODES + 1)
-struct kmem_list3 __initdata initkmem_list3[NUM_INIT_LISTS];
+struct kmem_list3 initkmem_list3[NUM_INIT_LISTS];
 #define	CACHE_CACHE 0
 #define	SIZE_AC 1
 #define	SIZE_L3 (1 + MAX_NUMNODES)
@@ -1960,7 +1960,7 @@ static void slab_destroy(struct kmem_cac
  * For setting up all the kmem_list3s for cache whose buffer_size is same as
  * size of kmem_list3.
  */
-static void __init set_up_list3s(struct kmem_cache *cachep, int index)
+static void set_up_list3s(struct kmem_cache *cachep, int index)
 {
 	int node;
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix section mismatch
  2007-05-11 15:35 [PATCH] Fix section mismatch Bernhard Walle
@ 2007-05-11 17:57 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2007-05-11 17:57 UTC (permalink / raw)
  To: Bernhard Walle; +Cc: linux-kernel

On Fri, 11 May 2007 17:35:22 +0200
Bernhard Walle <bwalle@suse.de> wrote:

> This patch fixes following compile warning:
> 
> --------- >8 --------
> WARNING: mm/built-in.o - Section mismatch: reference to .init.text: from .text
> between 'kmem_cache_create' (at offset 0x2167b) and 'drain_alien_cache'
> 
> WARNING: mm/built-in.o - Section mismatch: reference to .init.text: from .text
> between 'kmem_cache_create' (at offset 0x216c1) and 'drain_alien_cache'
> --------- 8< --------
> 
> set_up_list3s() can be called from setup_cpu_cache() [mm/slab.c] which is not
> an init function.
> 
> 

Yes.  This warning is a false positive.  See

static int setup_cpu_cache(struct kmem_cache *cachep)
{
	if (g_cpucache_up == FULL)
		return enable_cpucache(cachep);

	if (g_cpucache_up == NONE) {
		...
		set_up_list3s(cachep, SIZE_AC);

The g_cpucache_up==NONE state only exists before we have run free_initmem().

There is a similar false-positive down in acpi somewhere.

I think Sam is working on a scheme whereby we can add annotation to quash
the warnings in cases such as this.


> 
> ---
>  mm/slab.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -305,7 +305,7 @@ struct kmem_list3 {
>   * Need this for bootstrapping a per node allocator.
>   */
>  #define NUM_INIT_LISTS (2 * MAX_NUMNODES + 1)
> -struct kmem_list3 __initdata initkmem_list3[NUM_INIT_LISTS];
> +struct kmem_list3 initkmem_list3[NUM_INIT_LISTS];
>  #define	CACHE_CACHE 0
>  #define	SIZE_AC 1
>  #define	SIZE_L3 (1 + MAX_NUMNODES)
> @@ -1960,7 +1960,7 @@ static void slab_destroy(struct kmem_cac
>   * For setting up all the kmem_list3s for cache whose buffer_size is same as
>   * size of kmem_list3.
>   */
> -static void __init set_up_list3s(struct kmem_cache *cachep, int index)
> +static void set_up_list3s(struct kmem_cache *cachep, int index)
>  {
>  	int node;

That'll shut it up, but we'll use more memory at runtime.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-11 17:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-11 15:35 [PATCH] Fix section mismatch Bernhard Walle
2007-05-11 17:57 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox