Hi Christoph,

On 31/07/13 17:45, Christoph Lameter wrote:
> Crap you cannot do PAGE_SIZE allocations with kmalloc_large. Fails when
> freeing pages. Need to only do the multiple page allocs with
> kmalloc_large.
> 
> Subject: seq_file: Use kmalloc_large for page sized allocation
> 
> There is no point in using the slab allocation functions for
> large page order allocation. Use kmalloc_large().
> 
> This fixes the warning about large allocs but it will still cause
> large contiguous allocs that could fail because of memory fragmentation.

Thanks for the point, do you plan to make kmalloc_large available for extern 
access in a separate mainline patch?
Since kmalloc_large is statically defined in slub_def.h and when including it 
to seq_file.c
we have a lot of conflicting types:
..
In file included from ../linux/fs/seq_file.c:8:0:
../linux/include/linux/slub_def.h: In function 'kmalloc':
../linux/include/linux/slub_def.h:161:14: error: 'KMALLOC_MAX_CACHE_SIZE' 
undeclared (first use in this function)
../results/linux/include/linux/slub_def.h:161:14: note: each undeclared 
identifier is reported only once for each function it appears in
../linux/include/linux/slub_def.h:165:4: error: implicit declaration of 
function 'kmalloc_index' [-Werror=implicit-function-declaration]
../linux/include/linux/slub_def.h:168:12: error: 'ZERO_SIZE_PTR' undeclared 
(first use in this function)
../linux/include/linux/slub_def.h:170:34: error: 'kmalloc_caches' undeclared 
(first use in this function)
..


Thanks & BR
Wladislav Wiebe

> 
> Signed-off-by: Christoph Lameter <c...@linux.com>
> 
> Index: linux/fs/seq_file.c
> ===================================================================
> --- linux.orig/fs/seq_file.c  2013-07-31 10:39:03.050472030 -0500
> +++ linux/fs/seq_file.c       2013-07-31 10:39:03.050472030 -0500
> @@ -136,7 +136,7 @@ static int traverse(struct seq_file *m,
>  Eoverflow:
>       m->op->stop(m, p);
>       kfree(m->buf);
> -     m->buf = kmalloc(m->size <<= 1, GFP_KERNEL);
> +     m->buf = kmalloc_large(m->size <<= 1, GFP_KERNEL);
>       return !m->buf ? -ENOMEM : -EAGAIN;
>  }
> 
> @@ -232,7 +232,7 @@ ssize_t seq_read(struct file *file, char
>                       goto Fill;
>               m->op->stop(m, p);
>               kfree(m->buf);
> -             m->buf = kmalloc(m->size <<= 1, GFP_KERNEL);
> +             m->buf = kmalloc_large(m->size <<= 1, GFP_KERNEL);
>               if (!m->buf)
>                       goto Enomem;
>               m->count = 0;
> 


_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to