Skip to content

Commit

Permalink
xfs: kick extra large ioends to completion workqueue
Browse files Browse the repository at this point in the history
We've had reports of soft lockup warnings in the iomap ioend
completion path due to very large bios and/or bio chains. Divert any
ioends with 256k or more pages to process to the workqueue so
completion occurs in non-atomic context and can reschedule to avoid
soft lockup warnings.

Signed-off-by: Brian Foster <bfoster@redhat.com>
  • Loading branch information
Brian Foster authored and intel-lab-lkp committed Oct 2, 2020
1 parent 9e14bbf commit bfa33e7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion fs/xfs/xfs_aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ XFS_WPC(struct iomap_writepage_ctx *ctx)
return container_of(ctx, struct xfs_writepage_ctx, ctx);
}

/*
* Kick extra large ioends off to the workqueue. Completion will process a lot
* of pages for a large bio or bio chain and a non-atomic context is required to
* reschedule and avoid soft lockup warnings.
*/
#define XFS_LARGE_IOEND (262144 << PAGE_SHIFT)

/*
* Fast and loose check if this write could update the on-disk inode size.
*/
Expand Down Expand Up @@ -239,7 +246,8 @@ static inline bool xfs_ioend_needs_workqueue(struct iomap_ioend *ioend)
{
return ioend->io_private ||
ioend->io_type == IOMAP_UNWRITTEN ||
(ioend->io_flags & IOMAP_F_SHARED);
(ioend->io_flags & IOMAP_F_SHARED) ||
(ioend->io_size >= XFS_LARGE_IOEND);
}

STATIC void
Expand Down

0 comments on commit bfa33e7

Please sign in to comment.