Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1ffe203 authored by Deepak Kumar's avatar Deepak Kumar
Browse files

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: default avatarDeepak Kumar <dkumar@codeaurora.org>
parent a2005826
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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"
@@ -700,6 +701,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;
@@ -762,7 +767,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);