diff options
author | Stefan Wahren <stefan.wahren@i2se.com> | 2018-03-31 22:09:38 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-04-23 15:47:16 +0200 |
commit | 6dca544ebabb59a74ab408e15fbd64ac3e9665e4 (patch) | |
tree | 104293756f90115da4e922f6028073bec80581ac /drivers | |
parent | 8113b89fc615cfb531df0334fb3a091cf6a45ce0 (diff) |
staging: vchiq_core: Remove stackhog in process_free_queue
This removes the stackhog in process_free_queue by allocating the
necessary memory within the recycle thread main function instead
of the stack.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 80f6168f06f6..cc5b72fdf44b 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -620,10 +620,9 @@ reserve_space(VCHIQ_STATE_T *state, size_t space, int is_blocking) /* Called by the recycle thread. */ static void -process_free_queue(VCHIQ_STATE_T *state) +process_free_queue(VCHIQ_STATE_T *state, BITSET_T *service_found, size_t length) { VCHIQ_SHARED_STATE_T *local = state->local; - BITSET_T service_found[BITSET_SIZE(VCHIQ_MAX_SERVICES)]; int slot_queue_available; /* Find slots which have been freed by the other side, and return them @@ -656,7 +655,7 @@ process_free_queue(VCHIQ_STATE_T *state) /* Initialise the bitmask for services which have used this ** slot */ - BITSET_ZERO(service_found); + memset(service_found, 0, length); pos = 0; @@ -2183,11 +2182,20 @@ recycle_func(void *v) { VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v; VCHIQ_SHARED_STATE_T *local = state->local; + BITSET_T *found; + size_t length; + + length = sizeof(*found) * BITSET_SIZE(VCHIQ_MAX_SERVICES); + + found = kmalloc_array(BITSET_SIZE(VCHIQ_MAX_SERVICES), sizeof(*found), + GFP_KERNEL); + if (!found) + return -ENOMEM; while (1) { remote_event_wait(state, &local->recycle); - process_free_queue(state); + process_free_queue(state, found, length); } return 0; } |