From: Bart Van Assche <bart.vanassche@sandisk.com>
To: Jens Axboe <axboe@fb.com>
Cc: Tejun Heo <tj@kernel.org>,
James Bottomley <jejb@linux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Mike Snitzer <snitzer@redhat.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: [PATCH 2/3] block: Limit work processed in softirq context
Date: Mon, 28 Mar 2016 14:49:46 -0700 [thread overview]
Message-ID: <56F9A6FA.9040503@sandisk.com> (raw)
In-Reply-To: <56F9A692.2090704@sandisk.com>
Avoid that complaints like the one below are reported against a
debug kernel:
NMI watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [disk11_0:2708]
irq event stamp: 17120809
hardirqs last enabled at (17120808): [<ffffffff81599191>] _raw_spin_unlock_irqrestore+0x31/0x50
hardirqs last disabled at (17120809): [<ffff88046f223bd0>] 0xffff88046f223bd0
softirqs last enabled at (17120794): [<ffffffffa060aa67>] scst_check_blocked_dev+0x77/0x1c0 [scst]
softirqs last disabled at (17120795): [<ffffffff8159acbc>] do_softirq_own_stack+0x1c/0x30
RIP: 0010:[<ffffffff81599193>] [<ffffffff81599193>] _raw_spin_unlock_irqrestore+0x33/0x50
Call Trace:
<IRQ>
[<ffffffff81171450>] free_debug_processing+0x270/0x3a0
[<ffffffff8117277a>] __slab_free+0x17a/0x2c0
[<ffffffff81172a74>] kmem_cache_free+0x1b4/0x1d0
[<ffffffff8111a6c2>] mempool_free_slab+0x12/0x20
[<ffffffff8111a846>] mempool_free+0x26/0x80
[<ffffffff81294cb9>] bio_free+0x49/0x60
[<ffffffff81294cee>] bio_put+0x1e/0x30
[<ffffffffa0199d31>] end_clone_bio+0x21/0x70 [dm_mod]
[<ffffffff81294d52>] bio_endio+0x52/0x60
[<ffffffff8129aaec>] blk_update_request+0x7c/0x2a0
[<ffffffff813f4a8e>] scsi_end_request+0x2e/0x1d0
[<ffffffff813f7674>] scsi_io_completion+0xb4/0x610
[<ffffffff813ee79a>] scsi_finish_command+0xca/0x120
[<ffffffff813f6ef0>] scsi_softirq_done+0x120/0x140
[<ffffffff812a26e6>] blk_done_softirq+0x76/0x90
[<ffffffff8105bc1f>] __do_softirq+0x10f/0x230
[<ffffffff8159acbc>] do_softirq_own_stack+0x1c/0x30
<EOI>
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
---
block/blk-softirq.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/block/blk-softirq.c b/block/blk-softirq.c
index 53b1737..d4d2fe4 100644
--- a/block/blk-softirq.c
+++ b/block/blk-softirq.c
@@ -21,10 +21,22 @@ static DEFINE_PER_CPU(struct list_head, blk_cpu_done);
static void blk_done_softirq(struct softirq_action *h)
{
struct list_head *cpu_list, local_list;
+ struct request *e;
+ bool reraise = false;
+ int i = 0;
local_irq_disable();
cpu_list = this_cpu_ptr(&blk_cpu_done);
+ list_for_each_entry(e, cpu_list, ipi_list) {
+ if (++i < 256)
+ continue;
+ list_cut_position(&local_list, cpu_list, &e->ipi_list);
+ reraise = true;
+ goto enable_irq;
+ }
list_replace_init(cpu_list, &local_list);
+
+enable_irq:
local_irq_enable();
while (!list_empty(&local_list)) {
@@ -34,6 +46,14 @@ static void blk_done_softirq(struct softirq_action *h)
list_del_init(&rq->ipi_list);
rq->q->softirq_done_fn(rq);
}
+
+ if (!reraise)
+ return;
+
+ local_irq_disable();
+ if (!list_empty(cpu_list))
+ raise_softirq_irqoff(BLOCK_SOFTIRQ);
+ local_irq_enable();
}
#ifdef CONFIG_SMP
--
2.7.3
next prev parent reply other threads:[~2016-03-28 21:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-28 21:48 [PATCH 0/3] Improve block layer scheduling fairness Bart Van Assche
2016-03-28 21:48 ` [PATCH 1/3] kernel/kthread.c: Avoid CPU lockups Bart Van Assche
2016-03-28 21:49 ` Bart Van Assche [this message]
2016-03-28 21:50 ` [PATCH 3/3] Avoid that I/O completion processing triggers lockup complaints Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56F9A6FA.9040503@sandisk.com \
--to=bart.vanassche@sandisk.com \
--cc=axboe@fb.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=snitzer@redhat.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.