Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151839661
D23140.id66701.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D23140.id66701.diff
View Options
Index: sys/kern/vfs_subr.c
===================================================================
--- sys/kern/vfs_subr.c
+++ sys/kern/vfs_subr.c
@@ -1497,21 +1497,22 @@
* The routine can try to free a vnode or stall for up to 1 second waiting for
* vnlru to clear things up, but ultimately always performs a M_WAITOK allocation.
*/
-static struct vnode *
-vn_alloc(struct mount *mp)
+static u_long vn_alloc_cyclecount;
+
+static struct vnode * __noinline
+vn_alloc_hard(struct mount *mp)
{
u_long rnumvnodes, rfreevnodes;
- static u_long cyclecount;
mtx_lock(&vnode_list_mtx);
rnumvnodes = atomic_load_long(&numvnodes);
if (rnumvnodes + 1 < desiredvnodes) {
- cyclecount = 0;
+ vn_alloc_cyclecount = 0;
goto alloc;
}
rfreevnodes = atomic_load_long(&freevnodes);
- if (cyclecount++ >= rfreevnodes) {
- cyclecount = 0;
+ if (vn_alloc_cyclecount++ >= rfreevnodes) {
+ vn_alloc_cyclecount = 0;
vstir = 1;
}
/*
@@ -1547,6 +1548,22 @@
return (uma_zalloc(vnode_zone, M_WAITOK));
}
+static struct vnode *
+vn_alloc(struct mount *mp)
+{
+ u_long rnumvnodes;
+
+ if (__predict_false(vn_alloc_cyclecount != 0))
+ return (vn_alloc_hard(mp));
+ rnumvnodes = atomic_fetchadd_long(&numvnodes, 1) + 1;
+ if (__predict_false(vnlru_under(rnumvnodes, vlowat))) {
+ atomic_subtract_long(&numvnodes, 1);
+ return (vn_alloc_hard(mp));
+ }
+
+ return (uma_zalloc(vnode_zone, M_WAITOK));
+}
+
static void
vn_free(struct vnode *vp)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 12, 12:44 AM (15 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31316226
Default Alt Text
D23140.id66701.diff (1 KB)
Attached To
Mode
D23140: vfs: increment numvnodes without the vnode list lock unless under pressure
Attached
Detach File
Event Timeline
Log In to Comment