From 99a10d078d8c08bacd095650c5bfcdcef8f8bf20 Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Date: Thu, 16 Mar 2017 11:26:10 -0700 Subject: [PATCH] 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 --- scheduler/src/scheduler_core.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/scheduler/src/scheduler_core.c b/scheduler/src/scheduler_core.c index 7a61cec7aa6e..487cf4a01710 100644 --- a/scheduler/src/scheduler_core.c +++ b/scheduler/src/scheduler_core.c @@ -27,32 +27,20 @@ #include +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; }