From 251129e618233c60c23a098cdd2b6b6e504c5436 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Wed, 5 Jun 2019 21:15:45 +0200 Subject: kern/sref: reduce minimum epoch duration --- kern/sref.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/kern/sref.c b/kern/sref.c index 1b8426d5..1f306e60 100644 --- a/kern/sref.c +++ b/kern/sref.c @@ -53,7 +53,6 @@ #include #include #include -#include #include /* @@ -107,8 +106,7 @@ * of pending acknowledgment counter, and increments its local epoch ID, * preventing additional flushes during the same epoch. * - * The last processor to acknowledge arms a timer to schedule the start - * of the next epoch. + * The last processor to acknowledge starts the next epoch. * * The epoch ID and the pending acknowledgments counter fill an entire * cache line each in order to avoid false sharing on SMP. Whenever @@ -128,7 +126,6 @@ struct sref_data { alignas(CPU_L1_SIZE) unsigned int nr_pending_acks; }; - struct timer timer; struct syscnt sc_epochs; struct syscnt sc_dirty_zeroes; struct syscnt sc_true_zeroes; @@ -215,12 +212,10 @@ sref_data_check_epoch_id(const struct sref_data *data, unsigned int epoch_id) } static void -sref_data_start_epoch(struct timer *timer) +sref_data_start_epoch(struct sref_data *data) { - struct sref_data *data; unsigned int epoch_id; - data = structof(timer, struct sref_data, timer); assert(data->nr_pending_acks == 0); data->nr_pending_acks = cpu_count(); @@ -228,15 +223,6 @@ sref_data_start_epoch(struct timer *timer) atomic_store(&data->epoch_id, epoch_id + 1, ATOMIC_RELEASE); } -static void -sref_data_schedule_timer(struct sref_data *data) -{ - uint64_t ticks; - - ticks = clock_ticks_from_ms(SREF_EPOCH_START_DELAY); - timer_schedule(&data->timer, clock_get_time() + ticks); -} - static void sref_data_ack_cpu(struct sref_data *data) { @@ -250,7 +236,7 @@ sref_data_ack_cpu(struct sref_data *data) } syscnt_inc(&data->sc_epochs); - sref_data_schedule_timer(data); + sref_data_start_epoch(data); } static void @@ -932,9 +918,6 @@ sref_data_init(struct sref_data *data) data->epoch_id = SREF_EPOCH_ID_INIT_VALUE; data->nr_pending_acks = 0; - timer_init(&data->timer, sref_data_start_epoch, TIMER_HIGH_PRIO); - sref_data_schedule_timer(data); - syscnt_register(&data->sc_epochs, "sref_epochs"); syscnt_register(&data->sc_dirty_zeroes, "sref_dirty_zeroes"); syscnt_register(&data->sc_true_zeroes, "sref_true_zeroes"); @@ -953,8 +936,7 @@ INIT_OP_DEFINE(sref_bootstrap, INIT_OP_DEP(cpu_setup, true), INIT_OP_DEP(spinlock_setup, true), INIT_OP_DEP(syscnt_setup, true), - INIT_OP_DEP(thread_bootstrap, true), - INIT_OP_DEP(timer_bootstrap, true)); + INIT_OP_DEP(thread_bootstrap, true)); static int __init sref_setup(void) @@ -967,6 +949,8 @@ sref_setup(void) sref_cache_init_manager(percpu_ptr(sref_cache, i), i); } + sref_data_start_epoch(&sref_data); + return 0; } -- cgit v1.2.3