Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Take some pressure from vdrain lock:
details: https://anonhg.NetBSD.org/src/rev/d121d016dc63
branches: trunk
changeset: 1009279:d121d016dc63
user: hannken <hannken%NetBSD.org@localhost>
date: Sun Apr 19 13:25:00 2020 +0000
description:
Take some pressure from vdrain lock:
- Use cv_signal() instead of cv_broadcast(), there is only one waiter.
- No need to signal if number of vnodes doesn't increase.
- Use kpause(1) instead of yield().
diffstat:
sys/kern/vfs_vnode.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diffs (41 lines):
diff -r f539c8723318 -r d121d016dc63 sys/kern/vfs_vnode.c
--- a/sys/kern/vfs_vnode.c Sun Apr 19 13:22:58 2020 +0000
+++ b/sys/kern/vfs_vnode.c Sun Apr 19 13:25:00 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_vnode.c,v 1.120 2020/04/13 19:23:18 ad Exp $ */
+/* $NetBSD: vfs_vnode.c,v 1.121 2020/04/19 13:25:00 hannken Exp $ */
/*-
* Copyright (c) 1997-2011, 2019, 2020 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.120 2020/04/13 19:23:18 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.121 2020/04/19 13:25:00 hannken Exp $");
#ifdef _KERNEL_OPT
#include "opt_pax.h"
@@ -519,8 +519,9 @@
*/
numvnodes += d;
}
- if (numvnodes > desiredvnodes || listhd == &lru_list[LRU_VRELE])
- cv_broadcast(&vdrain_cv);
+ if ((d > 0 && numvnodes > desiredvnodes) ||
+ listhd == &lru_list[LRU_VRELE])
+ cv_signal(&vdrain_cv);
mutex_exit(&vdrain_lock);
}
@@ -686,9 +687,7 @@
}
if (vdrain_retry) {
- mutex_exit(&vdrain_lock);
- yield();
- mutex_enter(&vdrain_lock);
+ kpause("vdrainrt", false, 1, &vdrain_lock);
} else {
vdrain_gen++;
cv_broadcast(&vdrain_gen_cv);
Home |
Main Index |
Thread Index |
Old Index