Skip to content

Commit c84a83e

Browse files
committed
smp: don't warn about csd->flags having CSD_FLAG_LOCK cleared for !wait
blk-mq reuses the request potentially immediately, since the most cache hot is always given out first. This means that rq->csd could be reused between csd->func() being called and csd_unlock() being called. This isn't a problem, since we never use wait == 1 for the smp call function. Add CSD_FLAG_WAIT to be able to tell the difference, retaining the warning for other cases. Cc: Ingo Molnar <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent e3daab6 commit c84a83e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

kernel/smp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
1919
enum {
2020
CSD_FLAG_LOCK = 0x01,
21+
CSD_FLAG_WAIT = 0x02,
2122
};
2223

2324
struct call_function_data {
@@ -124,7 +125,7 @@ static void csd_lock(struct call_single_data *csd)
124125

125126
static void csd_unlock(struct call_single_data *csd)
126127
{
127-
WARN_ON(!(csd->flags & CSD_FLAG_LOCK));
128+
WARN_ON((csd->flags & CSD_FLAG_WAIT) && !(csd->flags & CSD_FLAG_LOCK));
128129

129130
/*
130131
* ensure we're all done before releasing data:
@@ -146,6 +147,9 @@ void generic_exec_single(int cpu, struct call_single_data *csd, int wait)
146147
unsigned long flags;
147148
int ipi;
148149

150+
if (wait)
151+
csd->flags |= CSD_FLAG_WAIT;
152+
149153
raw_spin_lock_irqsave(&dst->lock, flags);
150154
ipi = list_empty(&dst->list);
151155
list_add_tail(&csd->list, &dst->list);

0 commit comments

Comments
 (0)