mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-23 02:28:55 +00:00
Rely on call_rcu() to destroy the qpzone outside of locks
Reduce the number of qpzone_ref() and qpzone_unref() calls in qpzone_detachnode() by relying on the call_rcu to delay the destruction of the lock buckets.
This commit is contained in:
parent
6dcc398726
commit
1fa5219fdf
@ -28,7 +28,7 @@
|
|||||||
#include <isc/loop.h>
|
#include <isc/loop.h>
|
||||||
#include <isc/mem.h>
|
#include <isc/mem.h>
|
||||||
#include <isc/mutex.h>
|
#include <isc/mutex.h>
|
||||||
#include <isc/once.h>
|
#include <isc/os.h>
|
||||||
#include <isc/queue.h>
|
#include <isc/queue.h>
|
||||||
#include <isc/random.h>
|
#include <isc/random.h>
|
||||||
#include <isc/refcount.h>
|
#include <isc/refcount.h>
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <isc/loop.h>
|
#include <isc/loop.h>
|
||||||
#include <isc/mem.h>
|
#include <isc/mem.h>
|
||||||
#include <isc/mutex.h>
|
#include <isc/mutex.h>
|
||||||
#include <isc/once.h>
|
#include <isc/os.h>
|
||||||
#include <isc/random.h>
|
#include <isc/random.h>
|
||||||
#include <isc/refcount.h>
|
#include <isc/refcount.h>
|
||||||
#include <isc/result.h>
|
#include <isc/result.h>
|
||||||
@ -3939,17 +3939,15 @@ detachnode(dns_db_t *db, dns_dbnode_t **nodep DNS__DB_FLARG) {
|
|||||||
nlock = &qpdb->buckets[node->locknum].lock;
|
nlock = &qpdb->buckets[node->locknum].lock;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We can't destroy qpzonedb while holding a nodelock, so
|
* qpzone_destroy() uses call_rcu() API to destroy the node locks,
|
||||||
* we need to reference it before acquiring the lock
|
* so it is safe to call it in the middle of NODE_LOCK.
|
||||||
* and release it afterward.
|
|
||||||
*/
|
*/
|
||||||
qpzonedb_ref(qpdb);
|
|
||||||
|
|
||||||
|
rcu_read_lock();
|
||||||
NODE_RDLOCK(nlock, &nlocktype);
|
NODE_RDLOCK(nlock, &nlocktype);
|
||||||
qpznode_release(qpdb, node, 0, &nlocktype DNS__DB_FLARG_PASS);
|
qpznode_release(qpdb, node, 0, &nlocktype DNS__DB_FLARG_PASS);
|
||||||
NODE_UNLOCK(nlock, &nlocktype);
|
NODE_UNLOCK(nlock, &nlocktype);
|
||||||
|
rcu_read_unlock();
|
||||||
qpzonedb_detach(&qpdb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user