ubifs: limit the number of pages in shrink_liability
diff mbox series

Message ID 20190806142140.33013-1-fishland@aliyun.com
State New
Headers show
Series
  • ubifs: limit the number of pages in shrink_liability
Related show

Commit Message

Liu Song Aug. 6, 2019, 2:21 p.m. UTC
From: Liu Song <liu.song11@zte.com.cn> 

If the number of dirty pages to be written back is large,
then writeback_inodes_sb will block waiting for a long time,
causing hung task detection alarm. Therefore, we should limit
the maximum number of pages written back this time, which let
the budget be completed faster. The remaining dirty pages
tend to rely on the writeback mechanism to complete the
synchronization.

Signed-off-by: Liu Song <liu.song11@zte.com.cn>
---
 fs/ubifs/budget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Weinberger Aug. 6, 2019, 2:31 p.m. UTC | #1
----- Urspr√ľngliche Mail -----
> Von: "Liu Song" <fishland@aliyun.com>
> An: "richard" <richard@nod.at>, "Artem Bityutskiy" <dedekind1@gmail.com>, "Adrian Hunter" <adrian.hunter@intel.com>
> CC: "linux-mtd" <linux-mtd@lists.infradead.org>, "linux-kernel" <linux-kernel@vger.kernel.org>, "liu song11"
> <liu.song11@zte.com.cn>
> Gesendet: Dienstag, 6. August 2019 16:21:40
> Betreff: [PATCH] ubifs: limit the number of pages in shrink_liability

> From: Liu Song <liu.song11@zte.com.cn>
> 
> If the number of dirty pages to be written back is large,
> then writeback_inodes_sb will block waiting for a long time,
> causing hung task detection alarm. Therefore, we should limit
> the maximum number of pages written back this time, which let
> the budget be completed faster. The remaining dirty pages
> tend to rely on the writeback mechanism to complete the
> synchronization.

On which kind of system do you hit this?
Your fix makes sense but I'd like to have more background information.

UBIFS acts that way for almost a decade, see:
b6e51316daed ("writeback: separate starting of sync vs opportunistic writeback")

Thanks,
//richard

Patch
diff mbox series

diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c
index 80d7301ab76d..c0b84e960b20 100644
--- a/fs/ubifs/budget.c
+++ b/fs/ubifs/budget.c
@@ -51,7 +51,7 @@ 
 static void shrink_liability(struct ubifs_info *c, int nr_to_write)
 {
 	down_read(&c->vfs_sb->s_umount);
-	writeback_inodes_sb(c->vfs_sb, WB_REASON_FS_FREE_SPACE);
+	writeback_inodes_sb_nr(c->vfs_sb, nr_to_write, WB_REASON_FS_FREE_SPACE);
 	up_read(&c->vfs_sb->s_umount);
 }