summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_witness.c
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2012-04-06 06:53:58 +0000
committermelifaro <melifaro@FreeBSD.org>2012-04-06 06:53:58 +0000
commit8b1d10268c8ffd28f6c4b0da1e3906b139fc94cf (patch)
treeead0d5369047c56ec667d8a937da41d4682a0ed6 /sys/kern/subr_witness.c
parentb6974119420223f65336e5d64d2782bff6a82731 (diff)
downloadFreeBSD-src-8b1d10268c8ffd28f6c4b0da1e3906b139fc94cf.zip
FreeBSD-src-8b1d10268c8ffd28f6c4b0da1e3906b139fc94cf.tar.gz
- Improve BPF locking model.
Interface locks and descriptor locks are converted from mutex(9) to rwlock(9). This greately improves performance: in most common case we need to acquire 1 reader lock instead of 2 mutexes. - Remove filter(descriptor) (reader) lock in bpf_mtap[2] This was suggested by glebius@. We protect filter by requesting interface writer lock on filter change. - Cover struct bpf_if under BPF_INTERNAL define. This permits including bpf.h without including rwlock stuff. However, this is is temporary solution, struct bpf_if should be made opaque for any external caller. Found by: Dmitrij Tejblum <tejblum@yandex-team.ru> Sponsored by: Yandex LLC Reviewed by: glebius (previous version) Reviewed by: silence on -net@ Approved by: (mentor) MFC after: 3 weeks
Diffstat (limited to 'sys/kern/subr_witness.c')
-rw-r--r--sys/kern/subr_witness.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c
index bd2a5cb..52045b6 100644
--- a/sys/kern/subr_witness.c
+++ b/sys/kern/subr_witness.c
@@ -563,8 +563,8 @@ static struct witness_order_list_entry order_lists[] = {
* BPF
*/
{ "bpf global lock", &lock_class_mtx_sleep },
- { "bpf interface lock", &lock_class_mtx_sleep },
- { "bpf cdev lock", &lock_class_mtx_sleep },
+ { "bpf interface lock", &lock_class_rw },
+ { "bpf cdev lock", &lock_class_rw },
{ NULL, NULL },
/*
* NFS server
OpenPOWER on IntegriCloud