X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=smalloc.c;h=a2ad25a0a0d03bf5010c743325ed17e594e0fb83;hp=13995acce07f56c3b396427bb058676889148988;hb=04bc85a130c5dbe25dafe5fa5084c5bdcf63844a;hpb=d3d378218e9e03411749b65451b32d7a7466ff61 diff --git a/smalloc.c b/smalloc.c index 13995acc..a2ad25a0 100644 --- a/smalloc.c +++ b/smalloc.c @@ -3,26 +3,11 @@ * that can be shared across processes and threads */ #include -#include -#include #include #include -#include -#include -#include -#include -#include -#ifdef CONFIG_VALGRIND_DEV -#include -#else -#define RUNNING_ON_VALGRIND 0 -#define VALGRIND_MALLOCLIKE_BLOCK(addr, size, rzB, is_zeroed) do { } while (0) -#define VALGRIND_FREELIKE_BLOCK(addr, rzB) do { } while (0) -#endif #include "fio.h" #include "fio_sem.h" -#include "arch/arch.h" #include "os/os.h" #include "smalloc.h" #include "log.h" @@ -56,12 +41,6 @@ struct pool { size_t mmap_size; }; -#ifdef SMALLOC_REDZONE -#define REDZONE_SIZE sizeof(unsigned int) -#else -#define REDZONE_SIZE 0 -#endif - struct block_hdr { size_t size; #ifdef SMALLOC_REDZONE @@ -271,10 +250,6 @@ static void fill_redzone(struct block_hdr *hdr) { unsigned int *postred = postred_ptr(hdr); - /* Let Valgrind fill the red zones. */ - if (RUNNING_ON_VALGRIND) - return; - hdr->prered = SMALLOC_PRE_RED; *postred = SMALLOC_POST_RED; } @@ -283,10 +258,6 @@ static void sfree_check_redzone(struct block_hdr *hdr) { unsigned int *postred = postred_ptr(hdr); - /* Let Valgrind check the red zones. */ - if (RUNNING_ON_VALGRIND) - return; - if (hdr->prered != SMALLOC_PRE_RED) { log_err("smalloc pre redzone destroyed!\n" " ptr=%p, prered=%x, expected %x\n", @@ -354,7 +325,6 @@ void sfree(void *ptr) } if (pool) { - VALGRIND_FREELIKE_BLOCK(ptr, REDZONE_SIZE); sfree_pool(pool, ptr); return; } @@ -445,7 +415,7 @@ static void *smalloc_pool(struct pool *pool, size_t size) return ptr; } -static void *__smalloc(size_t size, bool is_zeroed) +void *smalloc(size_t size) { unsigned int i, end_pool; @@ -461,9 +431,6 @@ static void *__smalloc(size_t size, bool is_zeroed) if (ptr) { last_pool = i; - VALGRIND_MALLOCLIKE_BLOCK(ptr, size, - REDZONE_SIZE, - is_zeroed); return ptr; } } @@ -481,14 +448,9 @@ static void *__smalloc(size_t size, bool is_zeroed) return NULL; } -void *smalloc(size_t size) -{ - return __smalloc(size, false); -} - void *scalloc(size_t nmemb, size_t size) { - return __smalloc(nmemb * size, true); + return smalloc(nmemb * size); } char *smalloc_strdup(const char *str)