mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
qcacmn: Pre-allocate flex-mem segments
Pre-allocate the reduction_limit number of segments during flex-mem-pool initialization. Change-Id: I91581e04b94597ee4314ce8691b37a45066c5273 CRs-Fixed: 2241805
This commit is contained in:
parent
a5dfb6d847
commit
a487539d7d
1 changed files with 22 additions and 13 deletions
|
|
@ -24,18 +24,6 @@
|
|||
#include "qdf_trace.h"
|
||||
#include "qdf_util.h"
|
||||
|
||||
void qdf_flex_mem_init(struct qdf_flex_mem_pool *pool)
|
||||
{
|
||||
qdf_spinlock_create(&pool->lock);
|
||||
}
|
||||
qdf_export_symbol(qdf_flex_mem_init);
|
||||
|
||||
void qdf_flex_mem_deinit(struct qdf_flex_mem_pool *pool)
|
||||
{
|
||||
qdf_spinlock_destroy(&pool->lock);
|
||||
}
|
||||
qdf_export_symbol(qdf_flex_mem_deinit);
|
||||
|
||||
static struct qdf_flex_mem_segment *
|
||||
qdf_flex_mem_seg_alloc(struct qdf_flex_mem_pool *pool)
|
||||
{
|
||||
|
|
@ -49,10 +37,32 @@ qdf_flex_mem_seg_alloc(struct qdf_flex_mem_pool *pool)
|
|||
|
||||
seg->dynamic = true;
|
||||
seg->bytes = (uint8_t *)(seg + 1);
|
||||
seg->used_bitmap = 0;
|
||||
qdf_list_insert_back(&pool->seg_list, &seg->node);
|
||||
|
||||
return seg;
|
||||
}
|
||||
|
||||
void qdf_flex_mem_init(struct qdf_flex_mem_pool *pool)
|
||||
{
|
||||
int i;
|
||||
|
||||
qdf_spinlock_create(&pool->lock);
|
||||
|
||||
for (i = 0; i < pool->reduction_limit; i++)
|
||||
qdf_flex_mem_seg_alloc(pool);
|
||||
}
|
||||
qdf_export_symbol(qdf_flex_mem_init);
|
||||
|
||||
void qdf_flex_mem_deinit(struct qdf_flex_mem_pool *pool)
|
||||
{
|
||||
qdf_flex_mem_release(pool);
|
||||
QDF_BUG(!qdf_list_size(&pool->seg_list));
|
||||
|
||||
qdf_spinlock_destroy(&pool->lock);
|
||||
}
|
||||
qdf_export_symbol(qdf_flex_mem_deinit);
|
||||
|
||||
static void *__qdf_flex_mem_alloc(struct qdf_flex_mem_pool *pool)
|
||||
{
|
||||
struct qdf_flex_mem_segment *seg;
|
||||
|
|
@ -79,7 +89,6 @@ static void *__qdf_flex_mem_alloc(struct qdf_flex_mem_pool *pool)
|
|||
return NULL;
|
||||
|
||||
seg->used_bitmap = 1;
|
||||
qdf_list_insert_back(&pool->seg_list, &seg->node);
|
||||
|
||||
return seg->bytes;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue