summaryrefslogtreecommitdiff
path: root/lib/stackdepot.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2020-03-04 10:29:19 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-03-04 10:29:19 -0300
commitd46eec8e975a8180e178e01ba505801c44bc9a6c (patch)
treebff067e554fc03c576e107297085d30c8e381370 /lib/stackdepot.c
parentfdb64822443ec9fb8c3a74b598a74790ae8d2e22 (diff)
parentc395c3553d6870541f1c283479aea2a6f26364d5 (diff)
Merge remote-tracking branch 'acme/perf/urgent' into perf/core
To pick up fixes. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'lib/stackdepot.c')
-rw-r--r--lib/stackdepot.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/stackdepot.c b/lib/stackdepot.c
index ed717dd08ff3..81c69c08d1d1 100644
--- a/lib/stackdepot.c
+++ b/lib/stackdepot.c
@@ -83,15 +83,19 @@ static bool init_stack_slab(void **prealloc)
return true;
if (stack_slabs[depot_index] == NULL) {
stack_slabs[depot_index] = *prealloc;
+ *prealloc = NULL;
} else {
- stack_slabs[depot_index + 1] = *prealloc;
+ /* If this is the last depot slab, do not touch the next one. */
+ if (depot_index + 1 < STACK_ALLOC_MAX_SLABS) {
+ stack_slabs[depot_index + 1] = *prealloc;
+ *prealloc = NULL;
+ }
/*
* This smp_store_release pairs with smp_load_acquire() from
* |next_slab_inited| above and in stack_depot_save().
*/
smp_store_release(&next_slab_inited, 1);
}
- *prealloc = NULL;
return true;
}