Skip to contentSkip to conversation

f2fs: fix a hungtask problem caused by congestion_wait

PATCH In review Yunlei He 2 participants 2 messages Jun 21, 2018 F2FS file system

lore
Share & tools
lore

Yunlei He

author
#0 lore raw

PATCH v2 1/1 f2fs: fix a hungtask problem caused by congestion_wait

This patch fix hungtask problem which can be reproduced as follow:

Thread 0~3:
while true
do
touch /xxx/test/file_xxx
done

Thread 4 write a new checkpoint every three seconds.

In the meantime, fio start 16 threads for randwrite.

With my debug info, cycles num will exceed 1000 in function f2fs_sync_dirty_inodes, and most of cycle will be dropped into congestion_wait() and sleep more than 20ms. Cycles num reduced to 3 with this patch.

---
 fs/f2fs/checkpoint.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/f2fs/checkpoint.c +2 -4
index 9624a8f..1a1a0a2 100644
@@ -979,12 +979,10 @@ int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type)
 
 		iput(inode);
 		/* We need to give cpu to another writers. */
-		if (ino == cur_ino) {
-			congestion_wait(BLK_RW_ASYNC, HZ/50);
+		if (ino == cur_ino)
 			cond_resched();
-		} else {
+		else
 			ino = cur_ino;
-		}
 	} else {
 		/*
 		 * We should submit bio, since it exists several
Signature · 6 lines
1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Yunlei He

This patch fix hungtask problem which can be reproduced as follow:

Thread 0~3:
while true
do
touch /xxx/test/file_xxx
done

Thread 4 write a new checkpoint every three seconds.

Quoted 8 lines

In the meantime, fio start 16 threads for randwrite.

With my debug info, cycles num will exceed 1000 in function f2fs_sync_dirty_inodes, and most of cycle will be dropped into congestion_wait() and sleep more than 20ms. Cycles num reduced to 3 with this patch.

Thanks,

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot