linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]memblock: Fix potential section mismatch problem
@ 2013-06-12 16:08 Wang YanQing
  2013-06-12 17:29 ` Yinghai Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Wang YanQing @ 2013-06-12 16:08 UTC (permalink / raw)
  To: akpm; +Cc: yinghai, liwanp, tangchen, tj, linux-kernel, linux-mm


This patch convert __init to __init_memblock
for functions which make reference to memblock variable
with attribute __meminitdata.

Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 mm/memblock.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index c5fad93..ee74c69 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -766,7 +766,7 @@ int __init_memblock memblock_set_node(phys_addr_t base, phys_addr_t size,
 }
 #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
 
-static phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size,
+static phys_addr_t __init_memblock memblock_alloc_base_nid(phys_addr_t size,
 					phys_addr_t align, phys_addr_t max_addr,
 					int nid)
 {
@@ -785,17 +785,17 @@ static phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size,
 	return 0;
 }
 
-phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid)
+phys_addr_t __init_memblock memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid)
 {
 	return memblock_alloc_base_nid(size, align, MEMBLOCK_ALLOC_ACCESSIBLE, nid);
 }
 
-phys_addr_t __init __memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
+phys_addr_t __init_memblock __memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
 {
 	return memblock_alloc_base_nid(size, align, max_addr, MAX_NUMNODES);
 }
 
-phys_addr_t __init memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
+phys_addr_t __init_memblock memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
 {
 	phys_addr_t alloc;
 
@@ -808,12 +808,12 @@ phys_addr_t __init memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys
 	return alloc;
 }
 
-phys_addr_t __init memblock_alloc(phys_addr_t size, phys_addr_t align)
+phys_addr_t __init_memblock memblock_alloc(phys_addr_t size, phys_addr_t align)
 {
 	return memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ACCESSIBLE);
 }
 
-phys_addr_t __init memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid)
+phys_addr_t __init_memblock memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid)
 {
 	phys_addr_t res = memblock_alloc_nid(size, align, nid);
 
@@ -827,12 +827,12 @@ phys_addr_t __init memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, i
  * Remaining API functions
  */
 
-phys_addr_t __init memblock_phys_mem_size(void)
+phys_addr_t __init_memblock memblock_phys_mem_size(void)
 {
 	return memblock.memory.total_size;
 }
 
-phys_addr_t __init memblock_mem_size(unsigned long limit_pfn)
+phys_addr_t __init_memblock memblock_mem_size(unsigned long limit_pfn)
 {
 	unsigned long pages = 0;
 	struct memblock_region *r;
@@ -862,7 +862,7 @@ phys_addr_t __init_memblock memblock_end_of_DRAM(void)
 	return (memblock.memory.regions[idx].base + memblock.memory.regions[idx].size);
 }
 
-void __init memblock_enforce_memory_limit(phys_addr_t limit)
+void __init_memblock memblock_enforce_memory_limit(phys_addr_t limit)
 {
 	unsigned long i;
 	phys_addr_t max_addr = (phys_addr_t)ULLONG_MAX;
@@ -904,7 +904,7 @@ static int __init_memblock memblock_search(struct memblock_type *type, phys_addr
 	return -1;
 }
 
-int __init memblock_is_reserved(phys_addr_t addr)
+int __init_memblock memblock_is_reserved(phys_addr_t addr)
 {
 	return memblock_search(&memblock.reserved, addr) != -1;
 }
@@ -1016,12 +1016,12 @@ void __init_memblock __memblock_dump_all(void)
 	memblock_dump(&memblock.reserved, "reserved");
 }
 
-void __init memblock_allow_resize(void)
+void __init_memblock memblock_allow_resize(void)
 {
 	memblock_can_resize = 1;
 }
 
-static int __init early_memblock(char *p)
+static int __init_memblock early_memblock(char *p)
 {
 	if (p && strstr(p, "debug"))
 		memblock_debug = 1;
-- 
1.7.12.4.dirty

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH]memblock: Fix potential section mismatch problem
  2013-06-12 16:08 [PATCH]memblock: Fix potential section mismatch problem Wang YanQing
@ 2013-06-12 17:29 ` Yinghai Lu
  2013-06-13  1:58   ` Wang YanQing
  0 siblings, 1 reply; 3+ messages in thread
From: Yinghai Lu @ 2013-06-12 17:29 UTC (permalink / raw)
  To: Wang YanQing, Andrew Morton, Yinghai Lu, Wanpeng Li, Tang Chen,
	Tejun Heo, Linux Kernel Mailing List, Linux MM,
	Benjamin Herrenschmidt, David Miller, Sam Ravnborg

On Wed, Jun 12, 2013 at 9:08 AM, Wang YanQing <udknight@gmail.com> wrote:
>
> This patch convert __init to __init_memblock
> for functions which make reference to memblock variable
> with attribute __meminitdata.

for which arch?

for x86: __init_memblock is __init, so that is not problem.

for other arches like powerpc and sparc etc, __init_memblock is " "

so you need cc  powerpc, and sparc ...

>
> Signed-off-by: Wang YanQing <udknight@gmail.com>
> ---
>  mm/memblock.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index c5fad93..ee74c69 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -766,7 +766,7 @@ int __init_memblock memblock_set_node(phys_addr_t base, phys_addr_t size,
>  }
>  #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
>
> -static phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size,
> +static phys_addr_t __init_memblock memblock_alloc_base_nid(phys_addr_t size,
>                                         phys_addr_t align, phys_addr_t max_addr,
>                                         int nid)
>  {
> @@ -785,17 +785,17 @@ static phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size,
>         return 0;
>  }
>
> -phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid)
> +phys_addr_t __init_memblock memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int nid)
>  {
>         return memblock_alloc_base_nid(size, align, MEMBLOCK_ALLOC_ACCESSIBLE, nid);
>  }
>
> -phys_addr_t __init __memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
> +phys_addr_t __init_memblock __memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
>  {
>         return memblock_alloc_base_nid(size, align, max_addr, MAX_NUMNODES);
>  }
>
> -phys_addr_t __init memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
> +phys_addr_t __init_memblock memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
>  {
>         phys_addr_t alloc;
>
> @@ -808,12 +808,12 @@ phys_addr_t __init memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys
>         return alloc;
>  }
>
> -phys_addr_t __init memblock_alloc(phys_addr_t size, phys_addr_t align)
> +phys_addr_t __init_memblock memblock_alloc(phys_addr_t size, phys_addr_t align)
>  {
>         return memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ACCESSIBLE);
>  }
>
> -phys_addr_t __init memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid)
> +phys_addr_t __init_memblock memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid)
>  {
>         phys_addr_t res = memblock_alloc_nid(size, align, nid);
>
> @@ -827,12 +827,12 @@ phys_addr_t __init memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, i
>   * Remaining API functions
>   */
>
> -phys_addr_t __init memblock_phys_mem_size(void)
> +phys_addr_t __init_memblock memblock_phys_mem_size(void)
>  {
>         return memblock.memory.total_size;
>  }
>
> -phys_addr_t __init memblock_mem_size(unsigned long limit_pfn)
> +phys_addr_t __init_memblock memblock_mem_size(unsigned long limit_pfn)
>  {
>         unsigned long pages = 0;
>         struct memblock_region *r;
> @@ -862,7 +862,7 @@ phys_addr_t __init_memblock memblock_end_of_DRAM(void)
>         return (memblock.memory.regions[idx].base + memblock.memory.regions[idx].size);
>  }
>
> -void __init memblock_enforce_memory_limit(phys_addr_t limit)
> +void __init_memblock memblock_enforce_memory_limit(phys_addr_t limit)
>  {
>         unsigned long i;
>         phys_addr_t max_addr = (phys_addr_t)ULLONG_MAX;
> @@ -904,7 +904,7 @@ static int __init_memblock memblock_search(struct memblock_type *type, phys_addr
>         return -1;
>  }
>
> -int __init memblock_is_reserved(phys_addr_t addr)
> +int __init_memblock memblock_is_reserved(phys_addr_t addr)
>  {
>         return memblock_search(&memblock.reserved, addr) != -1;
>  }
> @@ -1016,12 +1016,12 @@ void __init_memblock __memblock_dump_all(void)
>         memblock_dump(&memblock.reserved, "reserved");
>  }
>
> -void __init memblock_allow_resize(void)
> +void __init_memblock memblock_allow_resize(void)
>  {
>         memblock_can_resize = 1;
>  }
>
> -static int __init early_memblock(char *p)
> +static int __init_memblock early_memblock(char *p)
>  {
>         if (p && strstr(p, "debug"))
>                 memblock_debug = 1;
> --
> 1.7.12.4.dirty

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH]memblock: Fix potential section mismatch problem
  2013-06-12 17:29 ` Yinghai Lu
@ 2013-06-13  1:58   ` Wang YanQing
  0 siblings, 0 replies; 3+ messages in thread
From: Wang YanQing @ 2013-06-13  1:58 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Andrew Morton, Wanpeng Li, Tang Chen, Tejun Heo,
	Linux Kernel Mailing List, Linux MM, Benjamin Herrenschmidt,
	David Miller, Sam Ravnborg

On Wed, Jun 12, 2013 at 10:29:17AM -0700, Yinghai Lu wrote:
> On Wed, Jun 12, 2013 at 9:08 AM, Wang YanQing <udknight@gmail.com> wrote:
> >
> > This patch convert __init to __init_memblock
> > for functions which make reference to memblock variable
> > with attribute __meminitdata.
> 
> for which arch?

I just think different arch could have different
meaning about __init and __init_memblock, but
if a function call another function with __init_memblock
annotation or has reference to variable with  __initdata_memblock,
then we have better to give it __init_memblock annotation.


> for x86: __init_memblock is __init, so that is not problem.

Thanks for point out this, then I know why I haven't get
compile warning.

> for other arches like powerpc and sparc etc, __init_memblock is " "
> 
> so you need cc  powerpc, and sparc ...

My first motivation to propose this patch was I found below 
two functions have different annotation which I think they 
should have the same annotation:

"
int __init memblock_is_reserved(phys_addr_t addr)
{
        return memblock_search(&memblock.reserved, addr) != -1;
}

int __init_memblock memblock_is_memory(phys_addr_t addr)
{
        return memblock_search(&memblock.memory, addr) != -1;
}
"


Thanks

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2013-06-13  1:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-12 16:08 [PATCH]memblock: Fix potential section mismatch problem Wang YanQing
2013-06-12 17:29 ` Yinghai Lu
2013-06-13  1:58   ` Wang YanQing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).