2019-01-05 21:22:47

by Olof Johansson

[permalink] [raw]
Subject: [PATCH] lib/genalloc.c: include vmalloc.h

Fixes build break on most ARM/ARM64 defconfigs:

lib/genalloc.c: In function 'gen_pool_add_virt':
lib/genalloc.c:190:10: error: implicit declaration of function 'vzalloc_node'; did you mean 'kzalloc_node'?
lib/genalloc.c:190:8: warning: assignment to 'struct gen_pool_chunk *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
lib/genalloc.c: In function 'gen_pool_destroy':
lib/genalloc.c:254:3: error: implicit declaration of function 'vfree'; did you mean 'kfree'?

Fixes: 6862d2fc8185 ('lib/genalloc.c: use vzalloc_node() to allocate the bitmap')
Cc: Huang Shijie <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Alexey Skidanov <[email protected]>
Signed-off-by: Olof Johansson <[email protected]>
---
lib/genalloc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/lib/genalloc.c b/lib/genalloc.c
index f365d71cdc774..7e85d1e37a6ea 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -35,6 +35,7 @@
#include <linux/interrupt.h>
#include <linux/genalloc.h>
#include <linux/of_device.h>
+#include <linux/vmalloc.h>

static inline size_t chunk_size(const struct gen_pool_chunk *chunk)
{
--
2.11.0



2019-01-05 21:37:46

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] lib/genalloc.c: include vmalloc.h

On Sat, Jan 5, 2019 at 1:21 PM Olof Johansson <[email protected]> wrote:
>
> Fixes build break on most ARM/ARM64 defconfigs:

Interesting.

Andrew, I thought ARM was one of the platforms that your tree compiled
against? Or was some other change just hiding this?

Anyway, I'll apply as soon as the previous build test finishes.

Linus

2019-01-05 21:47:34

by Olof Johansson

[permalink] [raw]
Subject: Re: [PATCH] lib/genalloc.c: include vmalloc.h

On Sat, Jan 5, 2019 at 1:35 PM Linus Torvalds
<[email protected]> wrote:
>
> On Sat, Jan 5, 2019 at 1:21 PM Olof Johansson <[email protected]> wrote:
> >
> > Fixes build break on most ARM/ARM64 defconfigs:
>
> Interesting.
>
> Andrew, I thought ARM was one of the platforms that your tree compiled
> against? Or was some other change just hiding this?
>
> Anyway, I'll apply as soon as the previous build test finishes.

Looks like the patch might have been queued pretty recently, I don't
see it in the Jan 3 linux-next tree.

I'm not familiar with Andrew's patch queues, but it seems to be there
in the 'mmots' (Jan 4), but not in 'mmotm' (Dec 22).


-Olof



-Olof

2019-01-07 22:57:39

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] lib/genalloc.c: include vmalloc.h

On Sat, 5 Jan 2019 13:35:33 -0800 Linus Torvalds <[email protected]> wrote:

> On Sat, Jan 5, 2019 at 1:21 PM Olof Johansson <[email protected]> wrote:
> >
> > Fixes build break on most ARM/ARM64 defconfigs:
>
> Interesting.
>
> Andrew, I thought ARM was one of the platforms that your tree compiled
> against? Or was some other change just hiding this?
>

I've become a bit lazy with the cross-compiling because linux-next's
build coverage is pretty broad. But Stephen's holiday interrupted
things and this one fell in that window.

2019-01-10 13:52:45

by peter enderborg

[permalink] [raw]
Subject: Re: [PATCH] lib/genalloc.c: include vmalloc.h

On 1/7/19 11:56 PM, Andrew Morton wrote:
> On Sat, 5 Jan 2019 13:35:33 -0800 Linus Torvalds <[email protected]> wrote:
>
>> On Sat, Jan 5, 2019 at 1:21 PM Olof Johansson <[email protected]> wrote:
>>> Fixes build break on most ARM/ARM64 defconfigs:
>> Interesting.
>>
>> Andrew, I thought ARM was one of the platforms that your tree compiled
>> against? Or was some other change just hiding this?
>>
> I've become a bit lazy with the cross-compiling because linux-next's
> build coverage is pretty broad. But Stephen's holiday interrupted
> things and this one fell in that window.
>
Is it now OK to use vmalloc in fast path's on all platforms?


2019-01-11 00:38:42

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] lib/genalloc.c: include vmalloc.h

On Thu, 10 Jan 2019 14:13:44 +0100 peter enderborg <[email protected]> wrote:

> On 1/7/19 11:56 PM, Andrew Morton wrote:
> > On Sat, 5 Jan 2019 13:35:33 -0800 Linus Torvalds <[email protected]> wrote:
> >
> >> On Sat, Jan 5, 2019 at 1:21 PM Olof Johansson <[email protected]> wrote:
> >>> Fixes build break on most ARM/ARM64 defconfigs:
> >> Interesting.
> >>
> >> Andrew, I thought ARM was one of the platforms that your tree compiled
> >> against? Or was some other change just hiding this?
> >>
> > I've become a bit lazy with the cross-compiling because linux-next's
> > build coverage is pretty broad. But Stephen's holiday interrupted
> > things and this one fell in that window.
> >
> Is it now OK to use vmalloc in fast path's on all platforms?

I'd say not. It is slower than kmalloc and these changes did nothing
to speed it up.

That being said, vmalloc is for "large" memory allocations and large
amounts of memory take large amount of time to utilize, so unless the
code is allocating then freeing memory without using it (don't do that)
then vmalloc() can never be a "fast path" thing?