File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,6 @@ struct io_wqe {
102
102
* Per io_wq state
103
103
*/
104
104
struct io_wq {
105
- struct io_wqe * * wqes ;
106
105
unsigned long state ;
107
106
108
107
free_work_fn * free_work ;
@@ -118,6 +117,8 @@ struct io_wq {
118
117
struct hlist_node cpuhp_node ;
119
118
120
119
struct task_struct * task ;
120
+
121
+ struct io_wqe * wqes [];
121
122
};
122
123
123
124
static enum cpuhp_state io_wq_online ;
@@ -907,17 +908,12 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)
907
908
if (WARN_ON_ONCE (!data -> free_work || !data -> do_work ))
908
909
return ERR_PTR (- EINVAL );
909
910
910
- wq = kzalloc (sizeof ( * wq ), GFP_KERNEL );
911
+ wq = kzalloc (struct_size ( wq , wqes , nr_node_ids ), GFP_KERNEL );
911
912
if (!wq )
912
913
return ERR_PTR (- ENOMEM );
913
-
914
- wq -> wqes = kcalloc (nr_node_ids , sizeof (struct io_wqe * ), GFP_KERNEL );
915
- if (!wq -> wqes )
916
- goto err_wq ;
917
-
918
914
ret = cpuhp_state_add_instance_nocalls (io_wq_online , & wq -> cpuhp_node );
919
915
if (ret )
920
- goto err_wqes ;
916
+ goto err_wq ;
921
917
922
918
refcount_inc (& data -> hash -> refs );
923
919
wq -> hash = data -> hash ;
@@ -962,8 +958,6 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)
962
958
cpuhp_state_remove_instance_nocalls (io_wq_online , & wq -> cpuhp_node );
963
959
for_each_node (node )
964
960
kfree (wq -> wqes [node ]);
965
- err_wqes :
966
- kfree (wq -> wqes );
967
961
err_wq :
968
962
kfree (wq );
969
963
return ERR_PTR (ret );
@@ -1036,7 +1030,6 @@ static void io_wq_destroy(struct io_wq *wq)
1036
1030
kfree (wqe );
1037
1031
}
1038
1032
io_wq_put_hash (wq -> hash );
1039
- kfree (wq -> wqes );
1040
1033
kfree (wq );
1041
1034
}
1042
1035
You can’t perform that action at this time.
0 commit comments