On 2022-07-12 01:23:15 [+0800], Schspa Shi wrote: > I want to know if this difference is by design. Yes. type1 (LAZY) does not need immediate action but can't be scheduled regularly like a workqueue. > If this is by design, we have a problem that the irq_work of type2 > will not execute as quickly as expected, it may be delayed by the > irq_work of type1. > > Please consider the following scenarios: > > If the CPU queued a type1 irq_work A, and then a type2 irq_work B. > But we won't make B executed quickly, because we won't issue the IPI > interrupt to wakeup irq_workd (the llist_add call will return false). But those two are different lists. So adding type1 to list1 does not affect type2 with list2 > This PATCH will issue the IPI_IRQ_WORK to make B execute quickly. > > One thing that needs to be optimized is that we now have > lazy_list.node.llist and lazy_work_raised which need to be granted > to be atomicity, disabled the local CPU IRQ to make this atomic. > There should be a better way to make these two variants to be atomically > and I can go in deep if this little problem is not by design, and need > to be fixed. > > If these two types of irq_work should be the same with the priority. > maybe we should change. > > if (!lazy_work || tick_nohz_tick_stopped()) { > arch_irq_work_raise(); > } > > to > > if (!(lazy_work || rt_lazy_work) || tick_nohz_tick_stopped()) { > arch_irq_work_raise(); > } but we wait for the timer for the lazy-work. RT has more LAZY items compared to !RT. So if there is an error then it should be visible there, too. Is there a problem with this? Adding (as you call it) type1 item does not affect type2 items. They will will processed asap. Sebastian