Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Prevent rt_free_global.wk from being enqueued to wor...
details: https://anonhg.NetBSD.org/src/rev/158e8738d74c
branches: trunk
changeset: 359117:158e8738d74c
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Tue Jan 30 11:01:04 2018 +0000
description:
Prevent rt_free_global.wk from being enqueued to workqueue doubly
diffstat:
sys/net/route.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diffs (55 lines):
diff -r 8919d8ae8226 -r 158e8738d74c sys/net/route.c
--- a/sys/net/route.c Tue Jan 30 10:40:02 2018 +0000
+++ b/sys/net/route.c Tue Jan 30 11:01:04 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.205 2018/01/23 07:20:10 ozaki-r Exp $ */
+/* $NetBSD: route.c,v 1.206 2018/01/30 11:01:04 ozaki-r Exp $ */
/*-
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.205 2018/01/23 07:20:10 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.206 2018/01/30 11:01:04 ozaki-r Exp $");
#include <sys/param.h>
#ifdef RTFLUSH_DEBUG
@@ -256,6 +256,7 @@
struct work wk;
kmutex_t lock;
SLIST_HEAD(, rtentry) queue;
+ bool enqueued;
} rt_free_global __cacheline_aligned;
/* psref for rtentry */
@@ -459,6 +460,7 @@
mutex_init(&rt_free_global.lock, MUTEX_DEFAULT, IPL_SOFTNET);
SLIST_INIT(&rt_free_global.queue);
+ rt_free_global.enqueued = false;
rt_psref_class = psref_class_create("rtentry", IPL_SOFTNET);
@@ -693,6 +695,7 @@
struct rtentry *rt;
mutex_enter(&rt_free_global.lock);
+ rt_free_global.enqueued = false;
if ((rt = SLIST_FIRST(&rt_free_global.queue)) == NULL) {
mutex_exit(&rt_free_global.lock);
return;
@@ -718,8 +721,11 @@
mutex_enter(&rt_free_global.lock);
rt_ref(rt);
SLIST_INSERT_HEAD(&rt_free_global.queue, rt, rt_free);
+ if (!rt_free_global.enqueued) {
+ workqueue_enqueue(rt_free_global.wq, &rt_free_global.wk, NULL);
+ rt_free_global.enqueued = true;
+ }
mutex_exit(&rt_free_global.lock);
- workqueue_enqueue(rt_free_global.wq, &rt_free_global.wk, NULL);
}
#ifdef NET_MPSAFE
Home |
Main Index |
Thread Index |
Old Index