qcacmn: Add qdf_flex_mem pool allocator

It often happens that the WLAN driver needs to allocate some pool of
structures to handle bursty operations. The traditional approach is to
statically allocate the maximum number of structures that we want to be
able to handle concurrently. This has the significant down side of
requiring manual tuning for every hardware combination for optimal
behavior, and wasting large amounts of memory during non-burst periods.

Add a new flexible, segmented memory allocator in QDF to help address
such scenarios. A small static buffer segment is used to service the
vast majority of operations, while additional segments are dynamically
allocated as needed to meet demand. Critically, these additional
segments are freed when not in use to reduce memory consumption. The
result is a self-tuning buffer that combines most of the benefits of
pure dynamic allocation with most of the benefits of pure static
allocation.

Change-Id: I5c27ecce72a450826494b5d13d6c9fdebda650a6
CRs-Fixed: 2224534
This commit is contained in:
Dustin Brown
2018-04-03 12:10:38 -07:00
committed by nshrivas
parent c60a22b88d
commit 19911f3a06
4 changed files with 286 additions and 3 deletions

View File

@@ -233,12 +233,11 @@ static inline bool __qdf_is_macaddr_equal(struct qdf_mac_addr *mac_addr1,
*/
#define qdf_in_interrupt in_interrupt
/**
* @brief memory barriers.
*/
#define __qdf_min(_a, _b) min(_a, _b)
#define __qdf_max(_a, _b) max(_a, _b)
#define __qdf_ffz(mask) (~(mask) == 0 ? -1 : ffz(mask))
#define MEMINFO_KB(x) ((x) << (PAGE_SHIFT - 10)) /* In kilobytes */
/**