mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 17:11:46 +00:00
gcov: use kvmalloc()
Using vmalloc() in gcov is really quite wasteful, many of the objects allocated are really small (e.g. I've seen 24 bytes.) Use kvmalloc() to automatically pick the better of kmalloc() or vmalloc() depending on the size. [johannes.berg@intel.com: fix clang-11+ build] Link: https://lkml.kernel.org/r/20210412214210.6e1ecca9cdc5.I24459763acf0591d5e6b31c7e3a59890d802f79c@changeid Link: https://lkml.kernel.org/r/20210315235453.799e7a9d627d.I741d0db096c6f312910f7f1bcdfde0fda20801a4@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Tested-by: Nick Desaulniers <ndesaulniers@google.com> Cc: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
3180c44fe1
commit
1391efa952
3 changed files with 12 additions and 12 deletions
|
@ -26,7 +26,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/mm.h>
|
||||
#include "gcov.h"
|
||||
|
||||
/**
|
||||
|
@ -116,7 +116,7 @@ static struct gcov_iterator *gcov_iter_new(struct gcov_info *info)
|
|||
/* Dry-run to get the actual buffer size. */
|
||||
size = convert_to_gcda(NULL, info);
|
||||
|
||||
iter = vmalloc(struct_size(iter, buffer, size));
|
||||
iter = kvmalloc(struct_size(iter, buffer, size), GFP_KERNEL);
|
||||
if (!iter)
|
||||
return NULL;
|
||||
|
||||
|
@ -134,7 +134,7 @@ static struct gcov_iterator *gcov_iter_new(struct gcov_info *info)
|
|||
*/
|
||||
static void gcov_iter_free(struct gcov_iterator *iter)
|
||||
{
|
||||
vfree(iter);
|
||||
kvfree(iter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue