Skip to contentSkip to conversation

block-mq: ratelimit the warning log

PATCH In review Junxiao Bi 1 participant 2 messages Nov 14, 2019 – Nov 19, 2019 Block layer

lore
Share & tools
lore

Junxiao Bi

author
#0 lore raw

PATCH 1/1 block-mq: ratelimit the warning log

When doing cpu online/offlile, sometimes this warning will be triggered, it's harmless, io will be dispatched. But sometimes it warns too much and even stall the whole system, so ratelimit it.

---
 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +1 -1
index ec791156e9cc..846f5d26c523 100644
@@ -1384,7 +1384,7 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
 	 *   handle dispatched requests to this hctx
 	 */
 	if (!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask) &&
-		cpu_online(hctx->next_cpu)) {
+		cpu_online(hctx->next_cpu) && printk_ratelimit()) {
 		printk(KERN_WARNING "run queue from wrong CPU %d, hctx %s\n",
 			raw_smp_processor_id(),
 			cpumask_empty(hctx->cpumask) ? "inactive": "active");
Signature · 1 line
2.17.1
author
#1 lore raw

Anybody help reviewing this?

Quoted 22 lines · Junxiao Bi

When doing cpu online/offlile, sometimes this warning will be triggered, it's harmless, io will be dispatched. But sometimes it warns too much and even stall the whole system, so ratelimit it.

---
  block/blk-mq.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +1 -1
index ec791156e9cc..846f5d26c523 100644
@@ -1384,7 +1384,7 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
  	 *   handle dispatched requests to this hctx
  	 */
  	if (!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask) &&
-		cpu_online(hctx->next_cpu)) {
+		cpu_online(hctx->next_cpu) && printk_ratelimit()) {
  		printk(KERN_WARNING "run queue from wrong CPU %d, hctx %s\n",
  			raw_smp_processor_id(),
  			cpumask_empty(hctx->cpumask) ? "inactive": "active");