msm: kgsl: Limit the frequency of logging on memory allocation failure

Excessive logging due to several successive memory allocation failure
may cause a watchdog bite. Hence, this change adds ratelimit to logging
on memory allocation failure.

Change-Id: I8e5d78918a32c48ef7fa587f3dc63cbd1f065d5f
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
This commit is contained in:
Deepak Kumar 2017-06-21 13:12:33 +05:30
parent c1a5075d60
commit d9eb3ce9a8

View file

@ -20,6 +20,7 @@
#include <linux/scatterlist.h>
#include <soc/qcom/scm.h>
#include <soc/qcom/secure_buffer.h>
#include <linux/ratelimit.h>
#include "kgsl.h"
#include "kgsl_sharedmem.h"
@ -699,6 +700,10 @@ kgsl_sharedmem_page_alloc_user(struct kgsl_memdesc *memdesc,
size_t len;
unsigned int align;
static DEFINE_RATELIMIT_STATE(_rs,
DEFAULT_RATELIMIT_INTERVAL,
DEFAULT_RATELIMIT_BURST);
size = PAGE_ALIGN(size);
if (size == 0 || size > UINT_MAX)
return -EINVAL;
@ -761,7 +766,8 @@ kgsl_sharedmem_page_alloc_user(struct kgsl_memdesc *memdesc,
*/
memdesc->size = (size - len);
if (sharedmem_noretry_flag != true)
if (sharedmem_noretry_flag != true &&
__ratelimit(&_rs))
KGSL_CORE_ERR(
"Out of memory: only allocated %lldKB of %lldKB requested\n",
(size - len) >> 10, size >> 10);