Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jul 2021 23:46:23 GMT
From:      Vladimir Kondratyev <wulf@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 6ba3ceaeb510 - stable/13 - LinuxKPI: Do not wait for a grace period in rcu_barrier()
Message-ID:  <202107202346.16KNkNYA054630@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=6ba3ceaeb51052ae9a39a597d81c49691ecdc78f

commit 6ba3ceaeb51052ae9a39a597d81c49691ecdc78f
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-07-05 00:19:50 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-07-20 22:43:52 +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
    Differential revision:  https://reviews.freebsd.org/D30809
    
    (cherry picked from commit 1ab61a193241f832e63f97ca37880b010469cb38)
---
 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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107202346.16KNkNYA054630>