0533 core: enable NSS cache resource reservation
All checks were successful
Source release / source-package (push) Successful in 1m22s
All checks were successful
Source release / source-package (push) Successful in 1m22s
This commit is contained in:
@@ -83,11 +83,11 @@ extern Latch_s ReserveResource; /* Used to pre-alloc or reserve
|
||||
* cache buffers
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
#define RESERVE_RSRC(_num) GRAB( &ReserveResource, (_num))
|
||||
#define RELEASE_RSRC(_num) DROP( &ReserveResource, (_num))
|
||||
#define FSM_RESERVE_RSRC(_num, _fsm, _action) \
|
||||
FSM_GRAB( &ReserveResource, (_num), (_fsm), (_action))
|
||||
FSM_GRAB( &ReserveResource, (_num), (_fsm), (voidfunc_t)(_action))
|
||||
#else
|
||||
#define RESERVE_RSRC(_num) ((void) 0)
|
||||
#define RELEASE_RSRC(_num) ((void) 0)
|
||||
|
||||
3
src/core/nss/cache/cache.c
vendored
3
src/core/nss/cache/cache.c
vendored
@@ -35,11 +35,13 @@
|
||||
#include <internal/pssConfig.h>
|
||||
#include <include/inst.h>
|
||||
#include <include/pssmpk.h>
|
||||
#include <include/reserveResources.h>
|
||||
#include <library/bitmap.h>
|
||||
#include <library/xStdlib.h>
|
||||
|
||||
CIRhead_t WaitForCacheQ;
|
||||
Latch_s ReserveBuffers;
|
||||
Latch_s ReserveResource;
|
||||
Buffer_s CACHE_SparseBuffer;
|
||||
CacheControl_s Cache = {0};
|
||||
|
||||
@@ -103,6 +105,7 @@ STATUS CACHE_Startup(void)
|
||||
CIR_INIT(LinuxWaitQ);
|
||||
CIR_INIT(Cache.waitQ);
|
||||
INIT_LATCH(&ReserveBuffers);
|
||||
INIT_COUNT(&ReserveResource, -PRERESERVE_FOR_BEAST_FLUSH);
|
||||
|
||||
memset(&CACHE_SparseBuffer, 0, sizeof(CACHE_SparseBuffer));
|
||||
CACHE_SparseBuffer.pBuf.data = NULL;
|
||||
|
||||
9
tests/core/cache/test_nwcore_cache.c
vendored
9
tests/core/cache/test_nwcore_cache.c
vendored
@@ -3,6 +3,7 @@
|
||||
#include <include/register.h>
|
||||
#include <internal/nCache.h>
|
||||
#include <internal/pssConfig.h>
|
||||
#include <include/reserveResources.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -27,6 +28,14 @@ int main(void)
|
||||
|
||||
MPKNSS_LOCK();
|
||||
CHECK(CACHE_Startup() == zOK);
|
||||
CHECK(NUM_RESOURCES() == -PRERESERVE_FOR_BEAST_FLUSH);
|
||||
INC_RSRC_CHECK(PRERESERVE_FOR_BEAST_FLUSH + NAME_RESERVE);
|
||||
CHECK(HAVE_RESOURCES(NAME_RESERVE - 1));
|
||||
RESERVE_RSRC(NAME_RESERVE);
|
||||
CHECK(NUM_RESOURCES() == 0);
|
||||
RELEASE_RSRC(NAME_RESERVE);
|
||||
CHECK(NUM_RESOURCES() == NAME_RESERVE);
|
||||
|
||||
initMyCache(&mycache, NULL, 12, "cache-test");
|
||||
|
||||
buffer = cacheAllocBuffer(&mycache, 7, 11, defaultSignal, CACHE_WRITE);
|
||||
|
||||
Reference in New Issue
Block a user