Message ID | 20230901111954.1804721-2-houtao@huaweicloud.com (mailing list archive) |
---|---|
State | Accepted |
Commit | d2fc491bc41d54006c67fb589d4920c3c6c37101 |
Delegated to: | BPF |
Headers | show |
Series | bpf: Enable IRQ after irq_work_raise() completes | expand |
diff --git a/kernel/bpf/memalloc.c b/kernel/bpf/memalloc.c index 9c49ae53deaf..962472ace98c 100644 --- a/kernel/bpf/memalloc.c +++ b/kernel/bpf/memalloc.c @@ -734,12 +734,17 @@ static void notrace *unit_alloc(struct bpf_mem_cache *c) } } local_dec(&c->active); - local_irq_restore(flags); WARN_ON(cnt < 0); if (cnt < c->low_watermark) irq_work_raise(c); + /* Enable IRQ after the enqueue of irq work completes, so irq work + * will run after IRQ is enabled and free_llist may be refilled by + * irq work before other task preempts current task. + */ + local_irq_restore(flags); + return llnode; }