On 5/27/22 10:53 AM, Xiaoguang Wang wrote: > @@ -9650,12 +9646,15 @@ static void io_free_file_tables(struct io_file_table *table) > table->bitmap = NULL; > } > > -static inline void io_file_bitmap_set(struct io_file_table *table, int bit) > +static inline void io_file_bitmap_set(struct io_ring_ctx *ctx, int bit) > { > + struct io_file_table *table = &ctx->file_table; > + > WARN_ON_ONCE(test_bit(bit, table->bitmap)); > __set_bit(bit, table->bitmap); > - if (bit == table->alloc_hint) > - table->alloc_hint++; > + table->alloc_hint = bit + 1; > + if (table->alloc_hint >= ctx->nr_user_files) > + table->alloc_hint = 0; > } This branch isn't needed, we'll reset it when failing to get one anyway. Much better than adding a branch to the fast path. -- Jens Axboe