File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,8 @@ static __cold void io_fallback_req_func(struct work_struct *work)
244244static __cold struct io_ring_ctx * io_ring_ctx_alloc (struct io_uring_params * p )
245245{
246246 struct io_ring_ctx * ctx ;
247+ unsigned hash_buckets ;
248+ size_t hash_size ;
247249 int hash_bits ;
248250
249251 ctx = kzalloc (sizeof (* ctx ), GFP_KERNEL );
@@ -259,15 +261,15 @@ static __cold struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
259261 */
260262 hash_bits = ilog2 (p -> cq_entries ) - 5 ;
261263 hash_bits = clamp (hash_bits , 1 , 8 );
264+ hash_buckets = 1U << hash_bits ;
265+ hash_size = hash_buckets * sizeof (struct io_hash_bucket );
262266
263267 ctx -> cancel_hash_bits = hash_bits ;
264- ctx -> cancel_hash =
265- kmalloc ((1U << hash_bits ) * sizeof (struct io_hash_bucket ),
266- GFP_KERNEL );
268+ ctx -> cancel_hash = kmalloc (hash_size , GFP_KERNEL );
267269 if (!ctx -> cancel_hash )
268270 goto err ;
269271
270- init_hash_table (ctx -> cancel_hash , 1U << hash_bits );
272+ init_hash_table (ctx -> cancel_hash , hash_buckets );
271273
272274 ctx -> dummy_ubuf = kzalloc (sizeof (* ctx -> dummy_ubuf ), GFP_KERNEL );
273275 if (!ctx -> dummy_ubuf )
You can’t perform that action at this time.
0 commit comments