From b46ddf5d187d603f72389ac047a99e80edb6285d Mon Sep 17 00:00:00 2001 From: Bjoern Brandenburg Date: Thu, 30 May 2013 14:34:22 +0200 Subject: Use vmalloc() to allocate Feather-Trace buffers Allocating contiguous buffers with kmalloc() is subject to severe maximum size limits. For Feather-Trace to work, we don't actually need *physically* contiguous memory; virtually contiguous memory is sufficient. By switching to vmalloc(), the code gets simpler and we can support much larger buffers. For convenience, this patch also adds a configuration option for the desired Feather-Trace buffer size and increases the default size. --- litmus/ftdev.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'litmus/ftdev.c') diff --git a/litmus/ftdev.c b/litmus/ftdev.c index 99bc39ffbcef..7126c61e8b4c 100644 --- a/litmus/ftdev.c +++ b/litmus/ftdev.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -21,13 +22,9 @@ struct ft_buffer* alloc_ft_buffer(unsigned int count, size_t size) if (!buf) return NULL; - total = (total / PAGE_SIZE) + (total % PAGE_SIZE != 0); - while (pages < total) { - order++; - pages *= 2; - } - mem = (char*) __get_free_pages(GFP_KERNEL, order); + mem = vmalloc(total); + if (!mem) { kfree(buf); return NULL; @@ -36,7 +33,7 @@ struct ft_buffer* alloc_ft_buffer(unsigned int count, size_t size) if (!init_ft_buffer(buf, count, size, mem + (count * size), /* markers at the end */ mem)) { /* buffer objects */ - free_pages((unsigned long) mem, order); + vfree(mem); kfree(buf); return NULL; } @@ -49,13 +46,7 @@ void free_ft_buffer(struct ft_buffer* buf) size_t total; if (buf) { - total = (buf->slot_size + 1) * buf->slot_count; - total = (total / PAGE_SIZE) + (total % PAGE_SIZE != 0); - while (pages < total) { - order++; - pages *= 2; - } - free_pages((unsigned long) buf->buffer_mem, order); + vfree(buf->buffer_mem); kfree(buf); } } -- cgit v1.2.2