* [PATCH v2] mm: memblock: drop __init from memblock functions to make it inline
@ 2020-11-16 11:35 Faiyaz Mohammed
2020-11-17 15:49 ` Mike Rapoport
0 siblings, 1 reply; 2+ messages in thread
From: Faiyaz Mohammed @ 2020-11-16 11:35 UTC (permalink / raw)
To: linux-mm, linux-kernel, rppt; +Cc: vinmenon, Faiyaz Mohammed
__init is used with inline due to which memblock wraper functions are
not getting inline.
for example:
[ 0.000000] memblock_alloc_try_nid: 1490 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 memblock_alloc+0x20/0x2c
[ 0.000000] memblock_reserve: [0x000000023f09a3c0-0x000000023f09a991] memblock_alloc_range_nid+0xc0/0x188
Dropping __init from memblock wrapper functions to make it inline and it
increase the debugability.
After:
[ 0.000000] memblock_alloc_try_nid: 1490 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 start_kernel+0xa4/0x568
[ 0.000000] memblock_reserve: [0x000000023f09a3c0-0x000000023f09a991] memblock_alloc_range_nid+0xc0/0x188
Signed-off-by: Faiyaz Mohammed <faiyazm@codeaurora.org>
---
include/linux/memblock.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index ef13125..f78113f 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -404,13 +404,13 @@ void *memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align,
phys_addr_t min_addr, phys_addr_t max_addr,
int nid);
-static inline void * __init memblock_alloc(phys_addr_t size, phys_addr_t align)
+static inline void *memblock_alloc(phys_addr_t size, phys_addr_t align)
{
return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT,
MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE);
}
-static inline void * __init memblock_alloc_raw(phys_addr_t size,
+static inline void *memblock_alloc_raw(phys_addr_t size,
phys_addr_t align)
{
return memblock_alloc_try_nid_raw(size, align, MEMBLOCK_LOW_LIMIT,
@@ -418,7 +418,7 @@ static inline void * __init memblock_alloc_raw(phys_addr_t size,
NUMA_NO_NODE);
}
-static inline void * __init memblock_alloc_from(phys_addr_t size,
+static inline void *memblock_alloc_from(phys_addr_t size,
phys_addr_t align,
phys_addr_t min_addr)
{
@@ -426,33 +426,33 @@ static inline void * __init memblock_alloc_from(phys_addr_t size,
MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE);
}
-static inline void * __init memblock_alloc_low(phys_addr_t size,
+static inline void *memblock_alloc_low(phys_addr_t size,
phys_addr_t align)
{
return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT,
ARCH_LOW_ADDRESS_LIMIT, NUMA_NO_NODE);
}
-static inline void * __init memblock_alloc_node(phys_addr_t size,
+static inline void *memblock_alloc_node(phys_addr_t size,
phys_addr_t align, int nid)
{
return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT,
MEMBLOCK_ALLOC_ACCESSIBLE, nid);
}
-static inline void __init memblock_free_early(phys_addr_t base,
+static inline void memblock_free_early(phys_addr_t base,
phys_addr_t size)
{
memblock_free(base, size);
}
-static inline void __init memblock_free_early_nid(phys_addr_t base,
+static inline void memblock_free_early_nid(phys_addr_t base,
phys_addr_t size, int nid)
{
memblock_free(base, size);
}
-static inline void __init memblock_free_late(phys_addr_t base, phys_addr_t size)
+static inline void memblock_free_late(phys_addr_t base, phys_addr_t size)
{
__memblock_free_late(base, size);
}
@@ -460,7 +460,7 @@ static inline void __init memblock_free_late(phys_addr_t base, phys_addr_t size)
/*
* Set the allocation direction to bottom-up or top-down.
*/
-static inline void __init memblock_set_bottom_up(bool enable)
+static inline void memblock_set_bottom_up(bool enable)
{
memblock.bottom_up = enable;
}
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] mm: memblock: drop __init from memblock functions to make it inline
2020-11-16 11:35 [PATCH v2] mm: memblock: drop __init from memblock functions to make it inline Faiyaz Mohammed
@ 2020-11-17 15:49 ` Mike Rapoport
0 siblings, 0 replies; 2+ messages in thread
From: Mike Rapoport @ 2020-11-17 15:49 UTC (permalink / raw)
To: Faiyaz Mohammed; +Cc: linux-mm, linux-kernel, vinmenon
On Mon, Nov 16, 2020 at 05:05:37PM +0530, Faiyaz Mohammed wrote:
> __init is used with inline due to which memblock wraper functions are
> not getting inline.
> for example:
> [ 0.000000] memblock_alloc_try_nid: 1490 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 memblock_alloc+0x20/0x2c
> [ 0.000000] memblock_reserve: [0x000000023f09a3c0-0x000000023f09a991] memblock_alloc_range_nid+0xc0/0x188
>
> Dropping __init from memblock wrapper functions to make it inline and it
> increase the debugability.
> After:
> [ 0.000000] memblock_alloc_try_nid: 1490 bytes align=0x40 nid=-1 from=0x0000000000000000 max_addr=0x0000000000000000 start_kernel+0xa4/0x568
> [ 0.000000] memblock_reserve: [0x000000023f09a3c0-0x000000023f09a991] memblock_alloc_range_nid+0xc0/0x188
>
> Signed-off-by: Faiyaz Mohammed <faiyazm@codeaurora.org>
Applied, thanks!
I've updated memblock_alloc() to be __always_inline because some
configurations make kbuild happy without it.
>> WARNING: modpost: vmlinux.o(.text.unlikely+0xbde): Section mismatch in reference from the function memblock_alloc() to the function .init.text:memblock_alloc_try_nid()
The function memblock_alloc() references
the function __init memblock_alloc_try_nid().
This is often because memblock_alloc lacks a __init
annotation or the annotation of memblock_alloc_try_nid is wrong.
> ---
> include/linux/memblock.h | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> index ef13125..f78113f 100644
> --- a/include/linux/memblock.h
> +++ b/include/linux/memblock.h
> @@ -404,13 +404,13 @@ void *memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align,
> phys_addr_t min_addr, phys_addr_t max_addr,
> int nid);
>
> -static inline void * __init memblock_alloc(phys_addr_t size, phys_addr_t align)
> +static inline void *memblock_alloc(phys_addr_t size, phys_addr_t align)
> {
> return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT,
> MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE);
> }
>
> -static inline void * __init memblock_alloc_raw(phys_addr_t size,
> +static inline void *memblock_alloc_raw(phys_addr_t size,
> phys_addr_t align)
> {
> return memblock_alloc_try_nid_raw(size, align, MEMBLOCK_LOW_LIMIT,
> @@ -418,7 +418,7 @@ static inline void * __init memblock_alloc_raw(phys_addr_t size,
> NUMA_NO_NODE);
> }
>
> -static inline void * __init memblock_alloc_from(phys_addr_t size,
> +static inline void *memblock_alloc_from(phys_addr_t size,
> phys_addr_t align,
> phys_addr_t min_addr)
> {
> @@ -426,33 +426,33 @@ static inline void * __init memblock_alloc_from(phys_addr_t size,
> MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE);
> }
>
> -static inline void * __init memblock_alloc_low(phys_addr_t size,
> +static inline void *memblock_alloc_low(phys_addr_t size,
> phys_addr_t align)
> {
> return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT,
> ARCH_LOW_ADDRESS_LIMIT, NUMA_NO_NODE);
> }
>
> -static inline void * __init memblock_alloc_node(phys_addr_t size,
> +static inline void *memblock_alloc_node(phys_addr_t size,
> phys_addr_t align, int nid)
> {
> return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT,
> MEMBLOCK_ALLOC_ACCESSIBLE, nid);
> }
>
> -static inline void __init memblock_free_early(phys_addr_t base,
> +static inline void memblock_free_early(phys_addr_t base,
> phys_addr_t size)
> {
> memblock_free(base, size);
> }
>
> -static inline void __init memblock_free_early_nid(phys_addr_t base,
> +static inline void memblock_free_early_nid(phys_addr_t base,
> phys_addr_t size, int nid)
> {
> memblock_free(base, size);
> }
>
> -static inline void __init memblock_free_late(phys_addr_t base, phys_addr_t size)
> +static inline void memblock_free_late(phys_addr_t base, phys_addr_t size)
> {
> __memblock_free_late(base, size);
> }
> @@ -460,7 +460,7 @@ static inline void __init memblock_free_late(phys_addr_t base, phys_addr_t size)
> /*
> * Set the allocation direction to bottom-up or top-down.
> */
> -static inline void __init memblock_set_bottom_up(bool enable)
> +static inline void memblock_set_bottom_up(bool enable)
> {
> memblock.bottom_up = enable;
> }
> --
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
> member of the Code Aurora Forum, hosted by The Linux Foundation
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-17 15:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16 11:35 [PATCH v2] mm: memblock: drop __init from memblock functions to make it inline Faiyaz Mohammed
2020-11-17 15:49 ` Mike Rapoport
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).