* [PATCH v2 1/3] mm: Silence vmap() allocation failures based on caller gfp_flags
2017-04-27 17:38 [PATCH 0/3 v2] ARM/ARM64: silence large module first time allocation Florian Fainelli
@ 2017-04-27 17:38 ` Florian Fainelli
2017-04-27 17:56 ` Michal Hocko
2017-04-27 17:38 ` [PATCH v2 2/3] ARM: Silence first allocation with CONFIG_ARM_MODULE_PLTS=y Florian Fainelli
2017-04-27 17:39 ` [PATCH v2 3/3] arm64: Silence first allocation with CONFIG_ARM64_MODULE_PLTS=y Florian Fainelli
2 siblings, 1 reply; 11+ messages in thread
From: Florian Fainelli @ 2017-04-27 17:38 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Florian Fainelli, Russell King, Catalin Marinas, Will Deacon,
Ard Biesheuvel, Andrew Morton, Michal Hocko, zijun_hu,
Kirill A. Shutemov, Andrey Ryabinin, Chris Wilson, open list,
open list:MEMORY MANAGEMENT, angus
If the caller has set __GFP_NOWARN don't print the following message:
vmap allocation for size 15736832 failed: use vmalloc=<size> to increase
size.
This can happen with the ARM/Linux or ARM64/Linux module loader built
with CONFIG_ARM{,64}_MODULE_PLTS=y which does a first attempt at loading
a large module from module space, then falls back to vmalloc space.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
mm/vmalloc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 0b057628a7ba..d8a851634674 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -521,9 +521,13 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
}
}
+ if (gfp_mask & __GFP_NOWARN)
+ goto out;
+
if (printk_ratelimit())
pr_warn("vmap allocation for size %lu failed: use vmalloc=<size> to increase size\n",
size);
+out:
kfree(va);
return ERR_PTR(-EBUSY);
}
--
2.9.3
--
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] 11+ messages in thread
* Re: [PATCH v2 1/3] mm: Silence vmap() allocation failures based on caller gfp_flags
2017-04-27 17:38 ` [PATCH v2 1/3] mm: Silence vmap() allocation failures based on caller gfp_flags Florian Fainelli
@ 2017-04-27 17:56 ` Michal Hocko
2017-04-27 18:03 ` Florian Fainelli
0 siblings, 1 reply; 11+ messages in thread
From: Michal Hocko @ 2017-04-27 17:56 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-arm-kernel, Russell King, Catalin Marinas, Will Deacon,
Ard Biesheuvel, Andrew Morton, zijun_hu, Kirill A. Shutemov,
Andrey Ryabinin, Chris Wilson, open list,
open list:MEMORY MANAGEMENT, angus
On Thu 27-04-17 10:38:58, Florian Fainelli wrote:
> If the caller has set __GFP_NOWARN don't print the following message:
> vmap allocation for size 15736832 failed: use vmalloc=<size> to increase
> size.
>
> This can happen with the ARM/Linux or ARM64/Linux module loader built
> with CONFIG_ARM{,64}_MODULE_PLTS=y which does a first attempt at loading
> a large module from module space, then falls back to vmalloc space.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Michal Hocko <mhocko@suse.com>
just a nit
> ---
> mm/vmalloc.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 0b057628a7ba..d8a851634674 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -521,9 +521,13 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
> }
> }
>
> + if (gfp_mask & __GFP_NOWARN)
> + goto out;
> +
> if (printk_ratelimit())
if (!(gfp_mask & __GFP_NOWARN) && printk_ratelimit())
> pr_warn("vmap allocation for size %lu failed: use vmalloc=<size> to increase size\n",
> size);
would be shorter and you wouldn't need the goto and a label.
> +out:
> kfree(va);
> return ERR_PTR(-EBUSY);
> }
> --
> 2.9.3
>
--
Michal Hocko
SUSE Labs
--
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] 11+ messages in thread
* Re: [PATCH v2 1/3] mm: Silence vmap() allocation failures based on caller gfp_flags
2017-04-27 17:56 ` Michal Hocko
@ 2017-04-27 18:03 ` Florian Fainelli
2017-04-27 18:20 ` Michal Hocko
0 siblings, 1 reply; 11+ messages in thread
From: Florian Fainelli @ 2017-04-27 18:03 UTC (permalink / raw)
To: Michal Hocko
Cc: linux-arm-kernel, Russell King, Catalin Marinas, Will Deacon,
Ard Biesheuvel, Andrew Morton, zijun_hu, Kirill A. Shutemov,
Andrey Ryabinin, Chris Wilson, open list,
open list:MEMORY MANAGEMENT, angus
On 04/27/2017 10:56 AM, Michal Hocko wrote:
> On Thu 27-04-17 10:38:58, Florian Fainelli wrote:
>> If the caller has set __GFP_NOWARN don't print the following message:
>> vmap allocation for size 15736832 failed: use vmalloc=<size> to increase
>> size.
>>
>> This can happen with the ARM/Linux or ARM64/Linux module loader built
>> with CONFIG_ARM{,64}_MODULE_PLTS=y which does a first attempt at loading
>> a large module from module space, then falls back to vmalloc space.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>
> Acked-by: Michal Hocko <mhocko@suse.com>
>
> just a nit
>
>> ---
>> mm/vmalloc.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
>> index 0b057628a7ba..d8a851634674 100644
>> --- a/mm/vmalloc.c
>> +++ b/mm/vmalloc.c
>> @@ -521,9 +521,13 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
>> }
>> }
>>
>> + if (gfp_mask & __GFP_NOWARN)
>> + goto out;
>> +
>> if (printk_ratelimit())
>
> if (!(gfp_mask & __GFP_NOWARN) && printk_ratelimit())
>> pr_warn("vmap allocation for size %lu failed: use vmalloc=<size> to increase size\n",
>> size);
>
> would be shorter and you wouldn't need the goto and a label.
Do you want me to resubmit with that change included?
--
Florian
--
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] 11+ messages in thread
* Re: [PATCH v2 1/3] mm: Silence vmap() allocation failures based on caller gfp_flags
2017-04-27 18:03 ` Florian Fainelli
@ 2017-04-27 18:20 ` Michal Hocko
2017-04-27 18:21 ` Florian Fainelli
0 siblings, 1 reply; 11+ messages in thread
From: Michal Hocko @ 2017-04-27 18:20 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-arm-kernel, Russell King, Catalin Marinas, Will Deacon,
Ard Biesheuvel, Andrew Morton, zijun_hu, Kirill A. Shutemov,
Andrey Ryabinin, Chris Wilson, open list,
open list:MEMORY MANAGEMENT, angus
On Thu 27-04-17 11:03:31, Florian Fainelli wrote:
> On 04/27/2017 10:56 AM, Michal Hocko wrote:
> > On Thu 27-04-17 10:38:58, Florian Fainelli wrote:
> >> If the caller has set __GFP_NOWARN don't print the following message:
> >> vmap allocation for size 15736832 failed: use vmalloc=<size> to increase
> >> size.
> >>
> >> This can happen with the ARM/Linux or ARM64/Linux module loader built
> >> with CONFIG_ARM{,64}_MODULE_PLTS=y which does a first attempt at loading
> >> a large module from module space, then falls back to vmalloc space.
> >>
> >> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> >
> > Acked-by: Michal Hocko <mhocko@suse.com>
> >
> > just a nit
> >
> >> ---
> >> mm/vmalloc.c | 4 ++++
> >> 1 file changed, 4 insertions(+)
> >>
> >> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> >> index 0b057628a7ba..d8a851634674 100644
> >> --- a/mm/vmalloc.c
> >> +++ b/mm/vmalloc.c
> >> @@ -521,9 +521,13 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
> >> }
> >> }
> >>
> >> + if (gfp_mask & __GFP_NOWARN)
> >> + goto out;
> >> +
> >> if (printk_ratelimit())
> >
> > if (!(gfp_mask & __GFP_NOWARN) && printk_ratelimit())
> >> pr_warn("vmap allocation for size %lu failed: use vmalloc=<size> to increase size\n",
> >> size);
> >
> > would be shorter and you wouldn't need the goto and a label.
>
> Do you want me to resubmit with that change included?
Up to you. As I've said this is a nit at best.
--
Michal Hocko
SUSE Labs
--
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] 11+ messages in thread
* Re: [PATCH v2 1/3] mm: Silence vmap() allocation failures based on caller gfp_flags
2017-04-27 18:20 ` Michal Hocko
@ 2017-04-27 18:21 ` Florian Fainelli
0 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2017-04-27 18:21 UTC (permalink / raw)
To: Michal Hocko
Cc: linux-arm-kernel, Russell King, Catalin Marinas, Will Deacon,
Ard Biesheuvel, Andrew Morton, zijun_hu, Kirill A. Shutemov,
Andrey Ryabinin, Chris Wilson, open list,
open list:MEMORY MANAGEMENT, angus
On 04/27/2017 11:20 AM, Michal Hocko wrote:
>>> would be shorter and you wouldn't need the goto and a label.
>>
>> Do you want me to resubmit with that change included?
>
> Up to you. As I've said this is a nit at best.
I just sent a v3 based on feedback from Ard, thanks!
--
Florian
--
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] 11+ messages in thread
* [PATCH v2 2/3] ARM: Silence first allocation with CONFIG_ARM_MODULE_PLTS=y
2017-04-27 17:38 [PATCH 0/3 v2] ARM/ARM64: silence large module first time allocation Florian Fainelli
2017-04-27 17:38 ` [PATCH v2 1/3] mm: Silence vmap() allocation failures based on caller gfp_flags Florian Fainelli
@ 2017-04-27 17:38 ` Florian Fainelli
2017-04-27 17:39 ` [PATCH v2 3/3] arm64: Silence first allocation with CONFIG_ARM64_MODULE_PLTS=y Florian Fainelli
2 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2017-04-27 17:38 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Florian Fainelli, Russell King, Catalin Marinas, Will Deacon,
Ard Biesheuvel, Andrew Morton, Michal Hocko, zijun_hu,
Kirill A. Shutemov, Andrey Ryabinin, Chris Wilson, open list,
open list:MEMORY MANAGEMENT, angus
When CONFIG_ARM_MODULE_PLTS is enabled, the first allocation using the
module space fails, because the module is too big, and then the module
allocation is attempted from vmalloc space. Silence the first allocation
failure in that case by setting __GFP_NOWARN.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
arch/arm/kernel/module.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index 80254b47dc34..503d1a39464a 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -40,8 +40,15 @@
#ifdef CONFIG_MMU
void *module_alloc(unsigned long size)
{
- void *p = __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
- GFP_KERNEL, PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE,
+ gfp_t gfp_mask = GFP_KERNEL;
+ void *p;
+
+#if IS_ENABLED(CONFIG_ARM_MODULE_PLTS)
+ /* Silence the initial allocation */
+ gfp_mask |= __GFP_NOWARN;
+#endif
+ p = __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
+ gfp_mask, PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE,
__builtin_return_address(0));
if (!IS_ENABLED(CONFIG_ARM_MODULE_PLTS) || p)
return p;
--
2.9.3
--
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] 11+ messages in thread
* [PATCH v2 3/3] arm64: Silence first allocation with CONFIG_ARM64_MODULE_PLTS=y
2017-04-27 17:38 [PATCH 0/3 v2] ARM/ARM64: silence large module first time allocation Florian Fainelli
2017-04-27 17:38 ` [PATCH v2 1/3] mm: Silence vmap() allocation failures based on caller gfp_flags Florian Fainelli
2017-04-27 17:38 ` [PATCH v2 2/3] ARM: Silence first allocation with CONFIG_ARM_MODULE_PLTS=y Florian Fainelli
@ 2017-04-27 17:39 ` Florian Fainelli
2017-04-27 18:07 ` Ard Biesheuvel
2 siblings, 1 reply; 11+ messages in thread
From: Florian Fainelli @ 2017-04-27 17:39 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Florian Fainelli, Russell King, Catalin Marinas, Will Deacon,
Ard Biesheuvel, Andrew Morton, Michal Hocko, zijun_hu,
Kirill A. Shutemov, Andrey Ryabinin, Chris Wilson, open list,
open list:MEMORY MANAGEMENT, angus
When CONFIG_ARM64_MODULE_PLTS is enabled, the first allocation using the
module space fails, because the module is too big, and then the module
allocation is attempted from vmalloc space. Silence the first allocation
failure in that case by setting __GFP_NOWARN.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
arch/arm64/kernel/module.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
index 7f316982ce00..58bd5cfdd544 100644
--- a/arch/arm64/kernel/module.c
+++ b/arch/arm64/kernel/module.c
@@ -32,11 +32,16 @@
void *module_alloc(unsigned long size)
{
+ gfp_t gfp_mask = GFP_KERNEL;
void *p;
+#if IS_ENABLED(CONFIG_ARM64_MODULE_PLTS)
+ /* Silence the initial allocation */
+ gfp_mask |= __GFP_NOWARN;
+#endif
p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
module_alloc_base + MODULES_VSIZE,
- GFP_KERNEL, PAGE_KERNEL_EXEC, 0,
+ gfp_mask, PAGE_KERNEL_EXEC, 0,
NUMA_NO_NODE, __builtin_return_address(0));
if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&
--
2.9.3
--
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] 11+ messages in thread
* Re: [PATCH v2 3/3] arm64: Silence first allocation with CONFIG_ARM64_MODULE_PLTS=y
2017-04-27 17:39 ` [PATCH v2 3/3] arm64: Silence first allocation with CONFIG_ARM64_MODULE_PLTS=y Florian Fainelli
@ 2017-04-27 18:07 ` Ard Biesheuvel
2017-04-27 18:09 ` Florian Fainelli
0 siblings, 1 reply; 11+ messages in thread
From: Ard Biesheuvel @ 2017-04-27 18:07 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-arm-kernel, Russell King, Catalin Marinas, Will Deacon,
Andrew Morton, Michal Hocko, zijun_hu, Kirill A. Shutemov,
Andrey Ryabinin, Chris Wilson, open list,
open list:MEMORY MANAGEMENT, angus
> On 27 Apr 2017, at 18:39, Florian Fainelli <f.fainelli@gmail.com> wrote:
>
> When CONFIG_ARM64_MODULE_PLTS is enabled, the first allocation using the
> module space fails, because the module is too big, and then the module
> allocation is attempted from vmalloc space. Silence the first allocation
> failure in that case by setting __GFP_NOWARN.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> arch/arm64/kernel/module.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
> index 7f316982ce00..58bd5cfdd544 100644
> --- a/arch/arm64/kernel/module.c
> +++ b/arch/arm64/kernel/module.c
> @@ -32,11 +32,16 @@
>
> void *module_alloc(unsigned long size)
> {
> + gfp_t gfp_mask = GFP_KERNEL;
> void *p;
>
> +#if IS_ENABLED(CONFIG_ARM64_MODULE_PLTS)
> + /* Silence the initial allocation */
> + gfp_mask |= __GFP_NOWARN;
> +#endif
Please use IS_ENABLED() instead here
> p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
> module_alloc_base + MODULES_VSIZE,
> - GFP_KERNEL, PAGE_KERNEL_EXEC, 0,
> + gfp_mask, PAGE_KERNEL_EXEC, 0,
> NUMA_NO_NODE, __builtin_return_address(0));
>
> if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&
> --
> 2.9.3
>
Other than that, and with Michal's nit addressed:
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
--
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] 11+ messages in thread
* Re: [PATCH v2 3/3] arm64: Silence first allocation with CONFIG_ARM64_MODULE_PLTS=y
2017-04-27 18:07 ` Ard Biesheuvel
@ 2017-04-27 18:09 ` Florian Fainelli
2017-04-27 18:12 ` Ard Biesheuvel
0 siblings, 1 reply; 11+ messages in thread
From: Florian Fainelli @ 2017-04-27 18:09 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: linux-arm-kernel, Russell King, Catalin Marinas, Will Deacon,
Andrew Morton, Michal Hocko, zijun_hu, Kirill A. Shutemov,
Andrey Ryabinin, Chris Wilson, open list,
open list:MEMORY MANAGEMENT, angus
On 04/27/2017 11:07 AM, Ard Biesheuvel wrote:
>
>> On 27 Apr 2017, at 18:39, Florian Fainelli <f.fainelli@gmail.com> wrote:
>>
>> When CONFIG_ARM64_MODULE_PLTS is enabled, the first allocation using the
>> module space fails, because the module is too big, and then the module
>> allocation is attempted from vmalloc space. Silence the first allocation
>> failure in that case by setting __GFP_NOWARN.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>> arch/arm64/kernel/module.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
>> index 7f316982ce00..58bd5cfdd544 100644
>> --- a/arch/arm64/kernel/module.c
>> +++ b/arch/arm64/kernel/module.c
>> @@ -32,11 +32,16 @@
>>
>> void *module_alloc(unsigned long size)
>> {
>> + gfp_t gfp_mask = GFP_KERNEL;
>> void *p;
>>
>> +#if IS_ENABLED(CONFIG_ARM64_MODULE_PLTS)
>> + /* Silence the initial allocation */
>> + gfp_mask |= __GFP_NOWARN;
>> +#endif
>
> Please use IS_ENABLED() instead here
How do you mean?
if (IS_ENABLED()) vs. #if IS_ENABLED()?
>
>> p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
>> module_alloc_base + MODULES_VSIZE,
>> - GFP_KERNEL, PAGE_KERNEL_EXEC, 0,
>> + gfp_mask, PAGE_KERNEL_EXEC, 0,
>> NUMA_NO_NODE, __builtin_return_address(0));
>>
>> if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&
>> --
>> 2.9.3
>>
>
> Other than that, and with Michal's nit addressed:
>
> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
--
Florian
--
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] 11+ messages in thread
* Re: [PATCH v2 3/3] arm64: Silence first allocation with CONFIG_ARM64_MODULE_PLTS=y
2017-04-27 18:09 ` Florian Fainelli
@ 2017-04-27 18:12 ` Ard Biesheuvel
0 siblings, 0 replies; 11+ messages in thread
From: Ard Biesheuvel @ 2017-04-27 18:12 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-arm-kernel, Russell King, Catalin Marinas, Will Deacon,
Andrew Morton, Michal Hocko, zijun_hu, Kirill A. Shutemov,
Andrey Ryabinin, Chris Wilson, open list,
open list:MEMORY MANAGEMENT, angus
> On 27 Apr 2017, at 19:09, Florian Fainelli <f.fainelli@gmail.com> wrote:
>
>> On 04/27/2017 11:07 AM, Ard Biesheuvel wrote:
>>
>>> On 27 Apr 2017, at 18:39, Florian Fainelli <f.fainelli@gmail.com> wrote:
>>>
>>> When CONFIG_ARM64_MODULE_PLTS is enabled, the first allocation using the
>>> module space fails, because the module is too big, and then the module
>>> allocation is attempted from vmalloc space. Silence the first allocation
>>> failure in that case by setting __GFP_NOWARN.
>>>
>>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>>> ---
>>> arch/arm64/kernel/module.c | 7 ++++++-
>>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
>>> index 7f316982ce00..58bd5cfdd544 100644
>>> --- a/arch/arm64/kernel/module.c
>>> +++ b/arch/arm64/kernel/module.c
>>> @@ -32,11 +32,16 @@
>>>
>>> void *module_alloc(unsigned long size)
>>> {
>>> + gfp_t gfp_mask = GFP_KERNEL;
>>> void *p;
>>>
>>> +#if IS_ENABLED(CONFIG_ARM64_MODULE_PLTS)
>>> + /* Silence the initial allocation */
>>> + gfp_mask |= __GFP_NOWARN;
>>> +#endif
>>
>> Please use IS_ENABLED() instead here
>
> How do you mean?
>
> if (IS_ENABLED()) vs. #if IS_ENABLED()?
>
Apologies, I didn't read carefully.
Use the C if not the preprocessor if
>>
>>> p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
>>> module_alloc_base + MODULES_VSIZE,
>>> - GFP_KERNEL, PAGE_KERNEL_EXEC, 0,
>>> + gfp_mask, PAGE_KERNEL_EXEC, 0,
>>> NUMA_NO_NODE, __builtin_return_address(0));
>>>
>>> if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&
>>> --
>>> 2.9.3
>>>
>>
>> Other than that, and with Michal's nit addressed:
>>
>> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>
>
>
> --
> Florian
--
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] 11+ messages in thread