io_uring: switch cancel_hash to use per entry spinlock
[linux-block.git] / io_uring / io_uring.c
index 957a5bc1b528c9ab27e32ddfc67d9df6c0d42283..ac6946e3f174b57566e43f237cfddf62c2c88b87 100644 (file)
@@ -89,6 +89,7 @@
 #include "fdinfo.h"
 #include "kbuf.h"
 #include "rsrc.h"
+#include "cancel.h"
 
 #include "timeout.h"
 #include "poll.h"
@@ -260,11 +261,13 @@ static __cold struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
        if (hash_bits <= 0)
                hash_bits = 1;
        ctx->cancel_hash_bits = hash_bits;
-       ctx->cancel_hash = kmalloc((1U << hash_bits) * sizeof(struct hlist_head),
-                                       GFP_KERNEL);
+       ctx->cancel_hash =
+               kmalloc((1U << hash_bits) * sizeof(struct io_hash_bucket),
+                       GFP_KERNEL);
        if (!ctx->cancel_hash)
                goto err;
-       __hash_init(ctx->cancel_hash, 1U << hash_bits);
+
+       init_hash_table(ctx->cancel_hash, 1U << hash_bits);
 
        ctx->dummy_ubuf = kzalloc(sizeof(*ctx->dummy_ubuf), GFP_KERNEL);
        if (!ctx->dummy_ubuf)