From 3ed192edc3353b0fd92d368dbb2f03124665d010 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Wed, 12 Jun 2024 14:48:15 +0200 Subject: [PATCH] Table: RCU synchronization moved to lfjour the sync is actually needed when the pages get freed, not precisely after every item cleanup, as the data technically stays intact until the deferred free's are called. --- lib/lockfree.c | 9 +++++---- nest/rt-table.c | 6 ------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/lockfree.c b/lib/lockfree.c index 6f8e66b9..3a2ccab7 100644 --- a/lib/lockfree.c +++ b/lib/lockfree.c @@ -359,10 +359,6 @@ lfjour_cleanup_hook(void *_j) { j->item_done(j, first); -#ifdef LOCAL_DEBUG - memset(first, 0xbd, j->item_size); -#endif - /* Find next journal item */ struct lfjour_item *next = lfjour_get_next(j, first); if (PAGE_HEAD(next) != PAGE_HEAD(first)) @@ -374,6 +370,11 @@ lfjour_cleanup_hook(void *_j) /* Free this block */ lfjour_block_rem_node(&j->pending, block); + + /* Wait for possible pending readers of the block */ + synchronize_rcu(); + + /* Now we can finally drop the block */ #ifdef LOCAL_DEBUG memset(block, 0xbe, page_size); #endif diff --git a/nest/rt-table.c b/nest/rt-table.c index 0266964e..e106a980 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -1503,9 +1503,6 @@ rt_cleanup_export_best(struct lfjour *j, struct lfjour_item *i) /* Update the first and last pointers */ rt_cleanup_update_pointers(&net->best, rpe); - - /* Wait for readers before releasing */ - synchronize_rcu(); } static void @@ -1530,9 +1527,6 @@ rt_cleanup_export_all(struct lfjour *j, struct lfjour_item *i) if (is_last) tab->gc_counter++; - - /* Wait for readers before releasing */ - synchronize_rcu(); } static void