git: 1ab61a193241 - main - LinuxKPI: Do not wait for a grace period in rcu_barrier()

Vladimir Kondratyev wulf at FreeBSD.org
Mon Jul 5 00:23:45 UTC 2021


The branch main has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=1ab61a193241f832e63f97ca37880b010469cb38

commit 1ab61a193241f832e63f97ca37880b010469cb38
Author:     Vladimir Kondratyev <wulf at FreeBSD.org>
AuthorDate: 2021-07-05 00:19:50 +0000
Commit:     Vladimir Kondratyev <wulf at FreeBSD.org>
CommitDate: 2021-07-05 00:19:50 +0000

    LinuxKPI: Do not wait for a grace period in rcu_barrier()
    
    Linux docs explicitly state that this is not required [1]:
    
    "Important note: The rcu_barrier() function is not, repeat, not,
    obligated to wait for a grace period.  It is instead only required to
    wait for RCU callbacks that have already been posted.  Therefore, if
    there are no RCU callbacks posted anywhere in the system, rcu_barrier()
    is within its rights to return immediately.  Even if there are
    callbacks posted, rcu_barrier() does not necessarily need to wait for
    a grace period."
    
    [1] https://www.kernel.org/doc/Documentation/RCU/Design/Requirements/Requirements.html
    
    Reviewed by:    emaste, hselasky, manu
    MFC after:      2 weeks
    Differential revision:  https://reviews.freebsd.org/D30809
---
 sys/compat/linuxkpi/common/src/linux_rcu.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_rcu.c b/sys/compat/linuxkpi/common/src/linux_rcu.c
index a39949cf5013..2179faa2c05e 100644
--- a/sys/compat/linuxkpi/common/src/linux_rcu.c
+++ b/sys/compat/linuxkpi/common/src/linux_rcu.c
@@ -367,8 +367,12 @@ linux_rcu_barrier(unsigned type)
 
 	MPASS(type < RCU_TYPE_MAX);
 
-	linux_synchronize_rcu(type);
-
+	/*
+	 * This function is not obligated to wait for a grace period.
+	 * It only waits for RCU callbacks that have already been posted.
+	 * If there are no RCU callbacks posted, rcu_barrier() can return
+	 * immediately.
+	 */
 	head = &linux_epoch_head[type];
 
 	/* wait for callbacks to complete */


More information about the dev-commits-src-all mailing list