@@ -7138,16 +7138,6 @@ static void **io_alloc_page_table(size_t size)
7138
7138
return table ;
7139
7139
}
7140
7140
7141
- static inline void io_rsrc_ref_lock (struct io_ring_ctx * ctx )
7142
- {
7143
- spin_lock_bh (& ctx -> rsrc_ref_lock );
7144
- }
7145
-
7146
- static inline void io_rsrc_ref_unlock (struct io_ring_ctx * ctx )
7147
- {
7148
- spin_unlock_bh (& ctx -> rsrc_ref_lock );
7149
- }
7150
-
7151
7141
static void io_rsrc_node_destroy (struct io_rsrc_node * ref_node )
7152
7142
{
7153
7143
percpu_ref_exit (& ref_node -> refs );
@@ -7164,9 +7154,9 @@ static void io_rsrc_node_switch(struct io_ring_ctx *ctx,
7164
7154
struct io_rsrc_node * rsrc_node = ctx -> rsrc_node ;
7165
7155
7166
7156
rsrc_node -> rsrc_data = data_to_kill ;
7167
- io_rsrc_ref_lock ( ctx );
7157
+ spin_lock_irq ( & ctx -> rsrc_ref_lock );
7168
7158
list_add_tail (& rsrc_node -> node , & ctx -> rsrc_ref_list );
7169
- io_rsrc_ref_unlock ( ctx );
7159
+ spin_unlock_irq ( & ctx -> rsrc_ref_lock );
7170
7160
7171
7161
atomic_inc (& data_to_kill -> refs );
7172
7162
percpu_ref_kill (& rsrc_node -> refs );
@@ -7674,9 +7664,10 @@ static void io_rsrc_node_ref_zero(struct percpu_ref *ref)
7674
7664
{
7675
7665
struct io_rsrc_node * node = container_of (ref , struct io_rsrc_node , refs );
7676
7666
struct io_ring_ctx * ctx = node -> rsrc_data -> ctx ;
7667
+ unsigned long flags ;
7677
7668
bool first_add = false;
7678
7669
7679
- io_rsrc_ref_lock ( ctx );
7670
+ spin_lock_irqsave ( & ctx -> rsrc_ref_lock , flags );
7680
7671
node -> done = true;
7681
7672
7682
7673
while (!list_empty (& ctx -> rsrc_ref_list )) {
@@ -7688,7 +7679,7 @@ static void io_rsrc_node_ref_zero(struct percpu_ref *ref)
7688
7679
list_del (& node -> node );
7689
7680
first_add |= llist_add (& node -> llist , & ctx -> rsrc_put_llist );
7690
7681
}
7691
- io_rsrc_ref_unlock ( ctx );
7682
+ spin_unlock_irqrestore ( & ctx -> rsrc_ref_lock , flags );
7692
7683
7693
7684
if (first_add )
7694
7685
mod_delayed_work (system_wq , & ctx -> rsrc_put_work , HZ );
0 commit comments