summaryrefslogtreecommitdiff
path: root/libbcachefs/rcu_pending.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-06-09 17:34:47 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-06-09 17:39:57 -0400
commit802903c8cf90f84248b31dd7776ecce148bb7b9c (patch)
tree0ec0d1e7ee7ea11ee9571c897dfa5f5562aa2bf7 /libbcachefs/rcu_pending.c
parent7e570195d49389fd7119b72d5de8fb458fc82f1a (diff)
Update bcachefs sources to a8d89eb264e0 bcachefs: Allow CONFIG_UNICODE=m
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/rcu_pending.c')
-rw-r--r--libbcachefs/rcu_pending.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/libbcachefs/rcu_pending.c b/libbcachefs/rcu_pending.c
index bef2aa1b..b1438be9 100644
--- a/libbcachefs/rcu_pending.c
+++ b/libbcachefs/rcu_pending.c
@@ -182,11 +182,6 @@ static inline void kfree_bulk(size_t nr, void ** p)
while (nr--)
kfree(*p);
}
-
-#define local_irq_save(flags) \
-do { \
- flags = 0; \
-} while (0)
#endif
static noinline void __process_finished_items(struct rcu_pending *pending,
@@ -429,9 +424,15 @@ __rcu_pending_enqueue(struct rcu_pending *pending, struct rcu_head *head,
BUG_ON((ptr != NULL) != (pending->process == RCU_PENDING_KVFREE_FN));
- local_irq_save(flags);
- p = this_cpu_ptr(pending->p);
- spin_lock(&p->lock);
+ /* We could technically be scheduled before taking the lock and end up
+ * using a different cpu's rcu_pending_pcpu: that's ok, it needs a lock
+ * anyways
+ *
+ * And we have to do it this way to avoid breaking PREEMPT_RT, which
+ * redefines how spinlocks work:
+ */
+ p = raw_cpu_ptr(pending->p);
+ spin_lock_irqsave(&p->lock, flags);
rcu_gp_poll_state_t seq = __get_state_synchronize_rcu(pending->srcu);
restart:
if (may_sleep &&
@@ -520,9 +521,8 @@ check_expired:
goto free_node;
}
- local_irq_save(flags);
- p = this_cpu_ptr(pending->p);
- spin_lock(&p->lock);
+ p = raw_cpu_ptr(pending->p);
+ spin_lock_irqsave(&p->lock, flags);
goto restart;
}