Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 12:40:03 UTC 2021

Modified Files:
        src/sys/external/bsd/common/linux: linux_rcu.c

Log Message:
linux: Rate-limit RCU GC thread as a cheap experiment.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/common/linux/linux_rcu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/common/linux/linux_rcu.c
diff -u src/sys/external/bsd/common/linux/linux_rcu.c:1.5 src/sys/external/bsd/common/linux/linux_rcu.c:1.6
--- src/sys/external/bsd/common/linux/linux_rcu.c:1.5	Sun Dec 19 12:07:55 2021
+++ src/sys/external/bsd/common/linux/linux_rcu.c	Sun Dec 19 12:40:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_rcu.c,v 1.5 2021/12/19 12:07:55 riastradh Exp $	*/
+/*	$NetBSD: linux_rcu.c,v 1.6 2021/12/19 12:40:03 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_rcu.c,v 1.5 2021/12/19 12:07:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_rcu.c,v 1.6 2021/12/19 12:40:03 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -276,6 +276,15 @@ gc_thread(void *cookie)
 		/* Finished a batch of work.  Notify rcu_barrier.  */
 		gc.gen++;
 		cv_broadcast(&gc.cv);
+
+		/*
+		 * Limit ourselves to one batch per tick, in an attempt
+		 * to make the batches larger.
+		 *
+		 * XXX We should maybe also limit the size of each
+		 * batch.
+		 */
+		(void)kpause("lxrcubat", /*intr*/false, /*timo*/1, &gc.lock);
 	}
 	KASSERT(gc.first_callback == NULL);
 	KASSERT(gc.first_kfree == NULL);

Reply via email to