+ lib-percpu_counterc-disable-local-irq-when-updating-percpu-couter.patch added to -mm tree
Subsystems (2)
[email protected]
maintainerSubject: + lib-percpu_counterc-disable-local-irq-when-updating-percpu-couter.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 07 Jan 2014 14:28:34 -0800
The patch titled
Subject: lib/percpu_counter.c: disable local irq when updating percpu couter
has been added to the -mm tree. Its filename is
lib-percpu_counterc-disable-local-irq-when-updating-percpu-couter.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/lib-percpu_counterc-disable-local-irq-when-updating-percpu-couter.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/lib-percpu_counterc-disable-local-irq-when-updating-percpu-couter.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Ming Lei <[email protected]>
Subject: lib/percpu_counter.c: disable local irq when updating percpu couter
__percpu_counter_add() may be called in softirq/hardirq handler (such as, blk_mq_queue_exit() is typically called in hardirq/softirq handler), so we need to disable local irq when updating the percpu counter, otherwise counts may be lost.
The patch fixes problem that 'rmmod null_blk' may hang in blk_cleanup_queue() because of miscounting of request_queue->mq_usage_counter.
---
lib/percpu_counter.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
lib/percpu_counter.c renamed from lib/percpu_counter.c~lib-percpu_counterc-disable-local-irq-when-updating-percpu-couter +5 -5
@@ -75,19 +75,19 @@ EXPORT_SYMBOL(percpu_counter_set);void __percpu_counter_add (struct percpu_counter *fbc,s64 amount,s32 batch) {s64 count; +unsigned long flags; -preempt_disable (); +raw_local_irq_save (flags); count =__this_cpu_read (*fbc->counters) + amount;if (count >= batch || count <= -batch) { -unsigned long flags; -raw_spin_lock_irqsave (&fbc->lock, flags); +raw_spin_lock (&fbc->lock); fbc->count += count; -raw_spin_unlock_irqrestore (&fbc->lock, flags); +raw_spin_unlock (&fbc->lock);__this_cpu_write (*fbc->counters,0 ); }else {__this_cpu_write (*fbc->counters, count); } -preempt_enable (); +raw_local_irq_restore (flags); }EXPORT_SYMBOL (__percpu_counter_add);
_
Patches currently in -mm which might be from [email protected] are
lib-percpu_counterc-disable-local-irq-when-updating-percpu-couter.patch linux-next.patch