diff options
author | Brian Behlendorf <[email protected]> | 2018-06-07 15:55:11 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2018-06-07 15:55:11 -0700 |
commit | 174bcd581d546be77d055273d2bad67cc854fc01 (patch) | |
tree | 6188d6908c25eb4a57a43ae8d6abf63ca0b0af8a | |
parent | 39042f97365c0e677e5e77ded90372526422afdf (diff) |
Fix preemptible warning in aggsum_add()
In the new aggsum counters the CPU_SEQID macro should be surrounded by
kpreempt_disable)() and kpreempt_enable() calls to prevent a Linux
kernel BUG warning. The addsum_add() function use the cpuid to
minimize lock contention when selecting a bucket, after selection
the bucket is protected by a mutex and it is safe to reschedule the
process to a different processor at any time.
Reviewed-by: Matthew Thode <[email protected]>
Reviewed-by: Paul Dagnelie <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #7609
Closes #7610
-rw-r--r-- | module/zfs/aggsum.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/module/zfs/aggsum.c b/module/zfs/aggsum.c index 171d0ff55..8d310e004 100644 --- a/module/zfs/aggsum.c +++ b/module/zfs/aggsum.c @@ -183,8 +183,11 @@ aggsum_borrow(aggsum_t *as, int64_t delta, struct aggsum_bucket *asb) void aggsum_add(aggsum_t *as, int64_t delta) { - struct aggsum_bucket *asb = - &as->as_buckets[CPU_SEQID % as->as_numbuckets]; + struct aggsum_bucket *asb; + + kpreempt_disable(); + asb = &as->as_buckets[CPU_SEQID % as->as_numbuckets]; + kpreempt_enable(); for (;;) { mutex_enter(&asb->asc_lock); |