Skip to content

Commit f9ed312

Browse files
ebiggersMikulas Patocka
authored andcommitted
dm-verity: use softirq context only when !need_resched()
Further limit verification in softirq (a.k.a. BH) context to cases where rescheduling of the interrupted task is not pending. This helps prevent the CPU from spending too long in softirq context. Note that handle_softirqs() in kernel/softirq.c already stops running softirqs in this same case. However, that check is too coarse-grained, since many I/O requests can be processed in a single BLOCK_SOFTIRQ. Signed-off-by: Eric Biggers <[email protected]> Signed-off-by: Mikulas Patocka <[email protected]>
1 parent abb4cf2 commit f9ed312

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/md/dm-verity-target.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,8 @@ static void verity_bh_work(struct work_struct *w)
682682
static inline bool verity_use_bh(unsigned int bytes, unsigned short ioprio)
683683
{
684684
return ioprio <= IOPRIO_CLASS_IDLE &&
685-
bytes <= READ_ONCE(dm_verity_use_bh_bytes[ioprio]);
685+
bytes <= READ_ONCE(dm_verity_use_bh_bytes[ioprio]) &&
686+
!need_resched();
686687
}
687688

688689
static void verity_end_io(struct bio *bio)

0 commit comments

Comments
 (0)