]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Table: RCU synchronization moved to lfjour
authorMaria Matejka <mq@ucw.cz>
Wed, 12 Jun 2024 12:48:15 +0000 (14:48 +0200)
committerMaria Matejka <mq@ucw.cz>
Wed, 12 Jun 2024 16:07:40 +0000 (18:07 +0200)
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
nest/rt-table.c

index 6f8e66b9dd713a34a5726077301dc018ade3db6d..3a2ccab75fd5414d2d3cd52b7aa073a2790dafa7 100644 (file)
@@ -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
index 0266964e5c69ff09d65b5e9bffb21df114455d05..e106a980a628c97c9464c981ff35c86db82129c5 100644 (file)
@@ -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