瀏覽代碼

qcacmn: Do not allocate scheduler context dynamically

Scheduler context size is more than 400KB so run time memory
allocation may fail when system memory is fragmented. Do not
allocate scheduler context memory dynamcially instead allocate
it from .bss section.

Change-Id: I19ebd0689f81b971bde271e1a540952cf41a6cba
CRs-Fixed: 2020711
Rajeev Kumar 8 年之前
父節點
當前提交
99a10d078d
共有 1 個文件被更改,包括 3 次插入15 次删除
  1. 3 15
      scheduler/src/scheduler_core.c

+ 3 - 15
scheduler/src/scheduler_core.c

@@ -27,32 +27,20 @@
 
 #include <scheduler_core.h>
 
+static struct scheduler_ctx g_sched_ctx;
 static struct scheduler_ctx *gp_sched_ctx;
 
 QDF_STATUS scheduler_create_ctx(void)
 {
-	if (gp_sched_ctx) {
-		QDF_ASSERT(0);
-		QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR,
-			  FL("there is a already gp_sched_ctx mem allocated"));
-		return QDF_STATUS_E_FAILURE;
-	}
+	gp_sched_ctx = &g_sched_ctx;
 
-	gp_sched_ctx = qdf_mem_malloc(sizeof(struct scheduler_ctx));
-	if (!gp_sched_ctx) {
-		QDF_ASSERT(0);
-		QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR,
-			  FL("gp_sched_ctx can't alloc mememory"));
-		return QDF_STATUS_E_FAILURE;
-	}
 	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS scheduler_destroy_ctx(void)
 {
-	if (gp_sched_ctx)
-		qdf_mem_free(gp_sched_ctx);
 	gp_sched_ctx = NULL;
+
 	return QDF_STATUS_SUCCESS;
 }