On Thu, Jul 06, 2023 at 10:23:49PM +0800, Chengming Zhou wrote: > Yes, should I change like below? Looks like much long code. :-) > > if (llist_add(&rq->ipi_list, &per_cpu(blk_cpu_done, cpu))) > smp_call_function_single_async(cpu, &per_cpu(blk_cpu_csd, cpu)); Doesn't look bad too me. > > > > > > But I think this code has a rpboem when it is preemptd between > > the llist_add and smp_call_function_single_async. We either need a > > get_cpu/put_cpu around them, or instroduce a structure with the list > > and csd, and then you can use one pointer from per_cpu and still ensure > > the list and csd are for the same CPU. > > > > cpu = rq->mq_ctx->cpu; So it's certainly the same CPU, right? You're right of couse - cpu is the submitting cpu and not the current one and thus not affected by preemption. Sorry for the noise.