diff options
| author | Abhishek Singh <absingh@qti.qualcomm.com> | 2015-12-01 11:56:51 +0530 |
|---|---|---|
| committer | Anjaneedevi Kapparapu <akappa@codeaurora.org> | 2015-12-03 15:24:25 +0530 |
| commit | d79d52ef4e03e4f575df5bd1a70c89588fcdcce2 (patch) | |
| tree | 6355cbdf13a776c64a5dc739724fb52d52a5bbab | |
| parent | ec0142716c6e5d48b3f9223be102315848704a97 (diff) | |
qcacld-2.0: Add log in vos_mem_alloc if kmalloc takes more than 3 seconds.
prima to qcacld-2.0 propagation
Sometime the thread sleeps in kmalloc for long time, resulting in
thread stuck.
This change prints time taken by kmalloc, if time taken is more
than 3 seconds.
Change-Id: I027ab2ad4e93f8a02ba9e48e47d7aa3123785a31
CRs-Fixed: 926479
| -rw-r--r-- | CORE/VOSS/src/vos_memory.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/CORE/VOSS/src/vos_memory.c b/CORE/VOSS/src/vos_memory.c index 3abb8fa17141..abb04238bcd9 100644 --- a/CORE/VOSS/src/vos_memory.c +++ b/CORE/VOSS/src/vos_memory.c @@ -53,6 +53,7 @@ * ------------------------------------------------------------------------*/ #include "vos_memory.h" #include "vos_trace.h" +#include "vos_api.h" #ifdef CONFIG_CNSS #include <net/cnss.h> @@ -104,6 +105,8 @@ static struct s_vos_mem_usage_struct g_usage_mem_buf[MAX_USAGE_TRACE_BUF_NUM]; * Preprocessor Definitions and Constants * ------------------------------------------------------------------------*/ +#define VOS_GET_MEMORY_TIME_THRESHOLD 3000 + /*--------------------------------------------------------------------------- * Type Declarations * ------------------------------------------------------------------------*/ @@ -394,6 +397,7 @@ v_VOID_t *vos_mem_malloc_debug(v_SIZE_t size, const char *fileName, v_SIZE_t new_size; int flags = GFP_KERNEL; unsigned long IrqFlags; + unsigned long time_before_kmalloc; if (size > (1024*1024)|| size == 0) @@ -421,8 +425,16 @@ v_VOID_t *vos_mem_malloc_debug(v_SIZE_t size, const char *fileName, #endif new_size = size + sizeof(struct s_vos_mem_struct) + 8; - + time_before_kmalloc = vos_timer_get_system_time(); memStruct = (struct s_vos_mem_struct*)kmalloc(new_size, flags); + /* If time taken by kmalloc is greater than + * VOS_GET_MEMORY_TIME_THRESHOLD msec + */ + if (vos_timer_get_system_time() - time_before_kmalloc >= + VOS_GET_MEMORY_TIME_THRESHOLD) + VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, + "%s: kmalloc took %lu msec", __func__, + vos_timer_get_system_time() - time_before_kmalloc); if(memStruct != NULL) { @@ -505,6 +517,9 @@ v_VOID_t * vos_mem_malloc( v_SIZE_t size ) #ifdef CONFIG_WCNSS_MEM_PRE_ALLOC v_VOID_t* pmem; #endif + v_VOID_t* memPtr = NULL; + unsigned long time_before_kmalloc; + if (size > (1024*1024) || size == 0) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, @@ -525,7 +540,17 @@ v_VOID_t * vos_mem_malloc( v_SIZE_t size ) } } #endif - return kmalloc(size, flags); + time_before_kmalloc = vos_timer_get_system_time(); + memPtr = kmalloc(size, flags); + /* If time taken by kmalloc is greater than + * VOS_GET_MEMORY_TIME_THRESHOLD msec + */ + if (vos_timer_get_system_time() - time_before_kmalloc >= + VOS_GET_MEMORY_TIME_THRESHOLD) + VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, + "%s: kmalloc took %lu msec", __func__, + vos_timer_get_system_time() - time_before_kmalloc); + return memPtr; } v_VOID_t vos_mem_free( v_VOID_t *ptr ) |
