summaryrefslogtreecommitdiffstats
path: root/include/os
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2020-07-11 17:13:45 -0700
committerGitHub <[email protected]>2020-07-11 17:13:45 -0700
commit3933305eaca95ad6c3003765326136d4d710ba0e (patch)
treea1c8f094f75c9771bd62c3310076b34dc60ed7b2 /include/os
parent6f1db5f37ede685ebe55d1549c635e0aef4661b5 (diff)
FreeBSD: Use a hash table for taskqid lookups
Previously a tqent could be recycled prematurely, update the code to use a hash table for lookups to resolve this. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #10529
Diffstat (limited to 'include/os')
-rw-r--r--include/os/freebsd/spl/sys/taskq.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/include/os/freebsd/spl/sys/taskq.h b/include/os/freebsd/spl/sys/taskq.h
index aaa435f2f..200f9e838 100644
--- a/include/os/freebsd/spl/sys/taskq.h
+++ b/include/os/freebsd/spl/sys/taskq.h
@@ -30,6 +30,7 @@
#include <sys/proc.h>
#include <sys/taskqueue.h>
#include <sys/thread.h>
+#include <sys/ck.h>
#ifdef __cplusplus
extern "C" {
@@ -37,26 +38,26 @@ extern "C" {
#define TASKQ_NAMELEN 31
-struct taskqueue;
-struct taskq {
+typedef struct taskq {
struct taskqueue *tq_queue;
-};
+} taskq_t;
-typedef struct taskq taskq_t;
typedef uintptr_t taskqid_t;
typedef void (task_func_t)(void *);
typedef struct taskq_ent {
struct task tqent_task;
+ struct timeout_task tqent_timeout_task;
task_func_t *tqent_func;
void *tqent_arg;
- struct timeout_task tqent_timeout_task;
- int tqent_type;
- int tqent_gen;
+ taskqid_t tqent_id;
+ CK_LIST_ENTRY(taskq_ent) tqent_hash;
+ uint8_t tqent_type;
+ uint8_t tqent_registered;
+ uint8_t tqent_cancelled;
+ volatile uint32_t tqent_rc;
} taskq_ent_t;
-struct proc;
-
/*
* Public flags for taskq_create(): bit range 0-15
*/