Skip to contentSkip to conversation

Do we need serial io for compress file?

f2fs-dev Fengnan Chang 2 participants 16 messages Nov 8, 2021 – Nov 15, 2021 8 messages not in the archive F2FS file system

lore
Share & tools
lore
#0 lore raw

In my test, serial io for compress file will make multithread small write performance drop a lot.

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to
improve sequential performance, but I don't understand why we should do this for
compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread is ok. So I think maybe we should use another lock to allow write different files in multithread.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

author
#1 lore raw

Anyway, I did some modify to verify my idea, and did some test, not found problem for now.

The modify as follows:

fs/f2fs/data.c +5 -2
index f4fd6c246c9a..0ed677efe820 100644
@@ -3165,8 +3165,6 @@ static inline bool __should_serialize_io(struct inode *inode,
 	if (IS_NOQUOTA(inode))
 		return false;
 
-	if (f2fs_need_compress_data(inode))
-		return true;
 	if (wbc->sync_mode != WB_SYNC_ALL)
 		return true;
 	if (get_dirty_pages(inode) >= SM_I(F2FS_I_SB(inode))->min_seq_blocks)
@@ -3218,11 +3216,16 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
 		mutex_lock(&sbi->writepages);
 		locked = true;
 	}
+	if (f2fs_need_compress_data(inode))
+		mutex_lock(&(F2FS_I(inode)->compress_lock));
 
 	blk_start_plug(&plug);
 	ret = f2fs_write_cache_pages(mapping, wbc, io_type);
 	blk_finish_plug(&plug);
 
+	if (f2fs_need_compress_data(inode))
+		mutex_unlock(&(F2FS_I(inode)->compress_lock));
+
 	if (locked)
 		mutex_unlock(&sbi->writepages);
 
fs/f2fs/f2fs.h +1 -0
index 039a229e11c9..3a6587f13d2f 100644
@@ -763,6 +763,7 @@ struct f2fs_inode_info {
 	struct list_head inmem_pages;	/* inmemory pages managed by f2fs */
 	struct task_struct *inmem_task;	/* store inmemory task */
 	struct mutex inmem_lock;	/* lock for inmemory pages */
+	struct mutex compress_lock;	/* lock for compress file */
 	struct extent_tree *extent_tree;	/* cached extent_tree entry */
 
 	/* avoid racing between foreground op and gc */
fs/f2fs/super.c +1 -0
index a133932333c5..8566e9c34540 100644
@@ -1323,6 +1323,7 @@ static struct inode *f2fs_alloc_inode(struct super_block *sb)
 	INIT_LIST_HEAD(&fi->inmem_ilist);
 	INIT_LIST_HEAD(&fi->inmem_pages);
 	mutex_init(&fi->inmem_lock);
+	mutex_init(&fi->compress_lock);
 	init_rwsem(&fi->i_gc_rwsem[READ]);
 	init_rwsem(&fi->i_gc_rwsem[WRITE]);
 	init_rwsem(&fi->i_xattr_sem);

--

Quoted 10 lines

-----Original Message-----
From: 常凤楠
Sent: Monday, November 8, 2021 11:55 AM
To: [email protected]; [email protected]
Cc: [email protected]
Subject: Do we need serial io for compress file?

In my test, serial io for compress file will make multithread small write performance drop a lot.

Quoted 7 lines

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why we should do this for compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread is ok. So I think maybe we should use another lock to allow write different files in multithread.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer
#2 lore raw
Quoted 1 line · 常凤楠

Anyway, I did some modify to verify my idea, and did some test, not found problem for now.

Could you please consider:
1. pin file
2. fallocate file w/ filesize keeped
- it will preallocate physical blocks aligned to segments
3. unpin file
4. overwrite compressed file

Thanks,

Quoted 69 lines

The modify as follows:

fs/f2fs/data.c +5 -2
index f4fd6c246c9a..0ed677efe820 100644
@@ -3165,8 +3165,6 @@ static inline bool __should_serialize_io(struct inode *inode,
  	if (IS_NOQUOTA(inode))
  		return false;
 
-	if (f2fs_need_compress_data(inode))
-		return true;
  	if (wbc->sync_mode != WB_SYNC_ALL)
  		return true;
  	if (get_dirty_pages(inode) >= SM_I(F2FS_I_SB(inode))->min_seq_blocks)
@@ -3218,11 +3216,16 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
  		mutex_lock(&sbi->writepages);
  		locked = true;
  	}
+	if (f2fs_need_compress_data(inode))
+		mutex_lock(&(F2FS_I(inode)->compress_lock));
 
  	blk_start_plug(&plug);
  	ret = f2fs_write_cache_pages(mapping, wbc, io_type);
  	blk_finish_plug(&plug);
 
+	if (f2fs_need_compress_data(inode))
+		mutex_unlock(&(F2FS_I(inode)->compress_lock));
+
  	if (locked)
  		mutex_unlock(&sbi->writepages);
 
fs/f2fs/f2fs.h +1 -0
index 039a229e11c9..3a6587f13d2f 100644
@@ -763,6 +763,7 @@ struct f2fs_inode_info {
  	struct list_head inmem_pages;	/* inmemory pages managed by f2fs */
  	struct task_struct *inmem_task;	/* store inmemory task */
  	struct mutex inmem_lock;	/* lock for inmemory pages */
+	struct mutex compress_lock;	/* lock for compress file */
  	struct extent_tree *extent_tree;	/* cached extent_tree entry */
 
  	/* avoid racing between foreground op and gc */
fs/f2fs/super.c +1 -1
index a133932333c5..8566e9c34540 100644
@@ -1323,6 +1323,7 @@ static struct inode *f2fs_alloc_inode(struct super_block *sb)
  	INIT_LIST_HEAD(&fi->inmem_ilist);
  	INIT_LIST_HEAD(&fi->inmem_pages);
  	mutex_init(&fi->inmem_lock);
+	mutex_init(&fi->compress_lock);
  	init_rwsem(&fi->i_gc_rwsem[READ]);
  	init_rwsem(&fi->i_gc_rwsem[WRITE]);
  	init_rwsem(&fi->i_xattr_sem);
--
Quoted 11 lines

-----Original Message-----
From: 常凤楠
Sent: Monday, November 8, 2021 11:55 AM
To: [email protected]; [email protected]
Cc: [email protected]
Subject: Do we need serial io for compress file?

In my test, serial io for compress file will make multithread small write performance drop a lot.

Quoted 7 lines
Quoted 7 lines

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why we should do this for compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread is ok. So I think maybe we should use another lock to allow write different files in multithread.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

A message that is not in the archive (sent off-list or not yet received): AI6AmQANEzwDyLqc-ild4qqN.9.1636381829406.Hmail.changfengnan@vivo.com

author
#4 lore raw
Quoted 11 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Chao Yu
Sent: Monday, November 8, 2021 10:30 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

On 2021/11/8 16:56, 常凤楠 wrote:

Quoted 8 lines
Quoted 1 line

Anyway, I did some modify to verify my idea, and did some test, not

found problem for now.

Could you please consider:
1. pin file
2. fallocate file w/ filesize keeped
- it will preallocate physical blocks aligned to segments 3. unpin file 4.
overwrite compressed file

So you means after step 1-3, it will make compressed file fragmentation worse ?

Thanks.

Quoted 51 lines

Thanks,

fs/f2fs/data.c static inline bool __should_serialize_io(struct

Quoted 8 lines

The modify as follows:

fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

f4fd6c246c9a..0ed677efe820 100644

fs/f2fs/data.c +0 -0
@@ -3165,8 +3165,6 @@ static inline bool __should_serialize_io(struct

inode *inode,

fs/f2fs/data.c static int __f2fs_write_data_pages(struct

Quoted 10 lines
fs/f2fs/data.c +0 -2
  	if (IS_NOQUOTA(inode))
  		return false;
 
-	if (f2fs_need_compress_data(inode))
-		return true;
  	if (wbc->sync_mode != WB_SYNC_ALL)
  		return true;
  	if (get_dirty_pages(inode) >=

SM_I(F2FS_I_SB(inode))->min_seq_blocks)

fs/f2fs/data.c +0 -0
@@ -3218,11 +3216,16 @@ static int __f2fs_write_data_pages(struct

address_space *mapping,

Quoted 21 lines
fs/f2fs/data.c +5 -0
  		mutex_lock(&sbi->writepages);
  		locked = true;
  	}
+	if (f2fs_need_compress_data(inode))
+		mutex_lock(&(F2FS_I(inode)->compress_lock));
 
  	blk_start_plug(&plug);
  	ret = f2fs_write_cache_pages(mapping, wbc, io_type);
  	blk_finish_plug(&plug);
 
+	if (f2fs_need_compress_data(inode))
+		mutex_unlock(&(F2FS_I(inode)->compress_lock));
+
  	if (locked)
  		mutex_unlock(&sbi->writepages);
 
fs/f2fs/f2fs.h index renamed from fs/f2fs/f2fs.h +0 -0

039a229e11c9..3a6587f13d2f 100644

fs/f2fs/f2fs.h struct f2fs_inode_info { · line 763

Quoted 1 line
fs/f2fs/f2fs.h +0 -0
@@ -763,6 +763,7 @@ struct f2fs_inode_info {
  	struct list_head inmem_pages;	/* inmemory pages managed by

f2fs */

Quoted 5 lines
fs/f2fs/f2fs.h +1 -0
  	struct task_struct *inmem_task;	/* store inmemory task */
  	struct mutex inmem_lock;	/* lock for inmemory pages */
+	struct mutex compress_lock;	/* lock for compress file */
  	struct extent_tree *extent_tree;	/* cached extent_tree entry */
 
Quoted 33 lines

fs/f2fs/super.c static struct inode *f2fs_alloc_inode(struct

Quoted 6 lines
fs/f2fs/f2fs.h +0 -0
  	/* avoid racing between foreground op and gc */ diff --git

a/fs/f2fs/super.c b/fs/f2fs/super.c index a133932333c5..8566e9c34540 100644

fs/f2fs/super.c +0 -0
@@ -1323,6 +1323,7 @@ static struct inode *f2fs_alloc_inode(struct

super_block *sb)

Quoted 26 lines
fs/f2fs/super.c +1 -1
  	INIT_LIST_HEAD(&fi->inmem_ilist);
  	INIT_LIST_HEAD(&fi->inmem_pages);
  	mutex_init(&fi->inmem_lock);
+	mutex_init(&fi->compress_lock);
  	init_rwsem(&fi->i_gc_rwsem[READ]);
  	init_rwsem(&fi->i_gc_rwsem[WRITE]);
  	init_rwsem(&fi->i_xattr_sem);
--
Quoted 18 lines

-----Original Message-----
From: 常凤楠
Sent: Monday, November 8, 2021 11:55 AM
To: [email protected]; [email protected]
Cc: [email protected]
Subject: Do we need serial io for compress file?

In my test, serial io for compress file will make multithread small write performance drop a lot.

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why we should do this for compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread is ok. So I think maybe we should use another lock to allow write different files in multithread.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer
#5 lore raw
Quoted 14 lines · 常凤楠
Quoted 14 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Chao Yu
Sent: Monday, November 8, 2021 10:30 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 1 line · 常凤楠

Anyway, I did some modify to verify my idea, and did some test, not

found problem for now.

Quoted 7 lines
Quoted 5 lines

Could you please consider:
1. pin file
2. fallocate file w/ filesize keeped
- it will preallocate physical blocks aligned to segments 3. unpin file 4.
overwrite compressed file

So you means after step 1-3, it will make compressed file fragmentation worse ?

Oh, I'm trying to find a way to avoid write performance regression due to race condition on writepages lock meanwhile avoiding fragmentation of compressed file. But I'm out of my mind, above case wouldn't help, please ignore this.

Thanks,

Quoted 86 lines

Thanks.

Quoted 84 lines

Thanks,

fs/f2fs/data.c static inline bool __should_serialize_io(struct

Quoted 8 lines

The modify as follows:

fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

f4fd6c246c9a..0ed677efe820 100644

fs/f2fs/data.c +0 -0
@@ -3165,8 +3165,6 @@ static inline bool __should_serialize_io(struct

inode *inode,

fs/f2fs/data.c static int __f2fs_write_data_pages(struct

Quoted 10 lines
fs/f2fs/data.c +0 -2
   	if (IS_NOQUOTA(inode))
   		return false;
 
-	if (f2fs_need_compress_data(inode))
-		return true;
   	if (wbc->sync_mode != WB_SYNC_ALL)
   		return true;
   	if (get_dirty_pages(inode) >=

SM_I(F2FS_I_SB(inode))->min_seq_blocks)

fs/f2fs/data.c +0 -0
@@ -3218,11 +3216,16 @@ static int __f2fs_write_data_pages(struct

address_space *mapping,

Quoted 21 lines
fs/f2fs/data.c +5 -0
   		mutex_lock(&sbi->writepages);
   		locked = true;
   	}
+	if (f2fs_need_compress_data(inode))
+		mutex_lock(&(F2FS_I(inode)->compress_lock));
 
   	blk_start_plug(&plug);
   	ret = f2fs_write_cache_pages(mapping, wbc, io_type);
   	blk_finish_plug(&plug);
 
+	if (f2fs_need_compress_data(inode))
+		mutex_unlock(&(F2FS_I(inode)->compress_lock));
+
   	if (locked)
   		mutex_unlock(&sbi->writepages);
 
fs/f2fs/f2fs.h index renamed from fs/f2fs/f2fs.h +0 -0

039a229e11c9..3a6587f13d2f 100644

fs/f2fs/f2fs.h struct f2fs_inode_info { · line 763

Quoted 1 line
fs/f2fs/f2fs.h +0 -0
@@ -763,6 +763,7 @@ struct f2fs_inode_info {
   	struct list_head inmem_pages;	/* inmemory pages managed by

f2fs */

fs/f2fs/super.c static struct inode *f2fs_alloc_inode(struct

Quoted 11 lines
fs/f2fs/f2fs.h +1 -0
   	struct task_struct *inmem_task;	/* store inmemory task */
   	struct mutex inmem_lock;	/* lock for inmemory pages */
+	struct mutex compress_lock;	/* lock for compress file */
   	struct extent_tree *extent_tree;	/* cached extent_tree entry */
 
   	/* avoid racing between foreground op and gc */ diff --git

a/fs/f2fs/super.c b/fs/f2fs/super.c index a133932333c5..8566e9c34540 100644

fs/f2fs/super.c +0 -0
@@ -1323,6 +1323,7 @@ static struct inode *f2fs_alloc_inode(struct

super_block *sb)

Quoted 26 lines
fs/f2fs/super.c +1 -1
   	INIT_LIST_HEAD(&fi->inmem_ilist);
   	INIT_LIST_HEAD(&fi->inmem_pages);
   	mutex_init(&fi->inmem_lock);
+	mutex_init(&fi->compress_lock);
   	init_rwsem(&fi->i_gc_rwsem[READ]);
   	init_rwsem(&fi->i_gc_rwsem[WRITE]);
   	init_rwsem(&fi->i_xattr_sem);
--
Quoted 18 lines

-----Original Message-----
From: 常凤楠
Sent: Monday, November 8, 2021 11:55 AM
To: [email protected]; [email protected]
Cc: [email protected]
Subject: Do we need serial io for compress file?

In my test, serial io for compress file will make multithread small write performance drop a lot.

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why we should do this for compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread is ok. So I think maybe we should use another lock to allow write different files in multithread.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

A message that is not in the archive (sent off-list or not yet received): AFUAIwC1E3YFUbOLaOBVbqp6.9.1636465594624.Hmail.changfengnan@vivo.com

author
#7 lore raw
Quoted 29 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Chao Yu
Sent: Tuesday, November 9, 2021 9:46 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 4 lines · 常凤楠
Quoted 4 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf

Of Chao

Quoted 6 lines
Quoted 6 lines

Yu
Sent: Monday, November 8, 2021 10:30 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 8 lines
Quoted 8 lines · 常凤楠
Quoted 1 line

Anyway, I did some modify to verify my idea, and did some test, not

found problem for now.

Could you please consider:
1. pin file
2. fallocate file w/ filesize keeped
- it will preallocate physical blocks aligned to segments 3. unpin file

4.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

overwrite compressed file

So you means after step 1-3, it will make compressed file fragmentation

worse ?

Oh, I'm trying to find a way to avoid write performance regression due to race condition on writepages lock meanwhile avoiding fragmentation of compressed file.

Yep, that's what I want to do, looking forward your idea. And how about the modify as below ?

Thanks.

Quoted 91 lines

But I'm out of my mind, above case wouldn't help, please ignore this.

Thanks,

Quoted 87 lines

Thanks.

Quoted 85 lines

Thanks,

Quoted 9 lines

The modify as follows:

fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

f4fd6c246c9a..0ed677efe820 100644

fs/f2fs/data.c +0 -0
@@ -3165,8 +3165,6 @@ static inline bool

__should_serialize_io(struct

inode *inode,

fs/f2fs/data.c static int __f2fs_write_data_pages(struct

Quoted 10 lines
   	if (IS_NOQUOTA(inode))
   		return false;
fs/f2fs/data.c +0 -2
-	if (f2fs_need_compress_data(inode))
-		return true;
   	if (wbc->sync_mode != WB_SYNC_ALL)
   		return true;
   	if (get_dirty_pages(inode) >=

SM_I(F2FS_I_SB(inode))->min_seq_blocks)

fs/f2fs/data.c +0 -0
@@ -3218,11 +3216,16 @@ static int __f2fs_write_data_pages(struct

address_space *mapping,

Quoted 21 lines
fs/f2fs/data.c +5 -0
   		mutex_lock(&sbi->writepages);
   		locked = true;
   	}
+	if (f2fs_need_compress_data(inode))
+		mutex_lock(&(F2FS_I(inode)->compress_lock));
 
   	blk_start_plug(&plug);
   	ret = f2fs_write_cache_pages(mapping, wbc, io_type);
   	blk_finish_plug(&plug);
 
+	if (f2fs_need_compress_data(inode))
+		mutex_unlock(&(F2FS_I(inode)->compress_lock));
+
   	if (locked)
   		mutex_unlock(&sbi->writepages);
 
fs/f2fs/f2fs.h index renamed from fs/f2fs/f2fs.h +0 -0

039a229e11c9..3a6587f13d2f 100644

fs/f2fs/f2fs.h struct f2fs_inode_info { · line 763

Quoted 1 line
fs/f2fs/f2fs.h +0 -0
@@ -763,6 +763,7 @@ struct f2fs_inode_info {
   	struct list_head inmem_pages;	/* inmemory pages managed by

f2fs */

fs/f2fs/super.c static struct inode *f2fs_alloc_inode(struct

Quoted 11 lines
fs/f2fs/f2fs.h +1 -0
   	struct task_struct *inmem_task;	/* store inmemory task */
   	struct mutex inmem_lock;	/* lock for inmemory pages */
+	struct mutex compress_lock;	/* lock for compress file */
   	struct extent_tree *extent_tree;	/* cached extent_tree entry */
 
   	/* avoid racing between foreground op and gc */ diff --git

a/fs/f2fs/super.c b/fs/f2fs/super.c index a133932333c5..8566e9c34540 100644

fs/f2fs/super.c +0 -0
@@ -1323,6 +1323,7 @@ static struct inode *f2fs_alloc_inode(struct

super_block *sb)

Quoted 26 lines
fs/f2fs/super.c +1 -1
   	INIT_LIST_HEAD(&fi->inmem_ilist);
   	INIT_LIST_HEAD(&fi->inmem_pages);
   	mutex_init(&fi->inmem_lock);
+	mutex_init(&fi->compress_lock);
   	init_rwsem(&fi->i_gc_rwsem[READ]);
   	init_rwsem(&fi->i_gc_rwsem[WRITE]);
   	init_rwsem(&fi->i_xattr_sem);
--
Quoted 18 lines

-----Original Message-----
From: 常凤楠
Sent: Monday, November 8, 2021 11:55 AM
To: [email protected]; [email protected]
Cc: [email protected]
Subject: Do we need serial io for compress file?

In my test, serial io for compress file will make multithread small write performance drop a lot.

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why we should do this for compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread is ok. So I think maybe we should use another lock to allow write different files in multithread.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer
#8 lore raw
Quoted 32 lines · 常凤楠
Quoted 32 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Chao Yu
Sent: Tuesday, November 9, 2021 9:46 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 4 lines · 常凤楠
Quoted 4 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf

Of Chao

Quoted 6 lines
Quoted 6 lines

Yu
Sent: Monday, November 8, 2021 10:30 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 8 lines
Quoted 8 lines · 常凤楠
Quoted 1 line

Anyway, I did some modify to verify my idea, and did some test, not

found problem for now.

Could you please consider:
1. pin file
2. fallocate file w/ filesize keeped
- it will preallocate physical blocks aligned to segments 3. unpin file

4.

Quoted 3 lines
Quoted 1 line

overwrite compressed file

So you means after step 1-3, it will make compressed file fragmentation

Quoted 8 lines
Quoted 5 lines

worse ?

Oh, I'm trying to find a way to avoid write performance regression due to race condition on writepages lock meanwhile avoiding fragmentation of compressed file.

Yep, that's what I want to do, looking forward your idea. And how about the modify as below ?

We will still suffer fragmentation in race condition in between compressed file write and normal file write?

Thanks,

Quoted 93 lines

Thanks.

Quoted 91 lines

But I'm out of my mind, above case wouldn't help, please ignore this.

Thanks,

Quoted 87 lines

Thanks.

Quoted 85 lines

Thanks,

Quoted 9 lines

The modify as follows:

fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

f4fd6c246c9a..0ed677efe820 100644

fs/f2fs/data.c +0 -0
@@ -3165,8 +3165,6 @@ static inline bool

__should_serialize_io(struct

inode *inode,

fs/f2fs/data.c static int __f2fs_write_data_pages(struct

Quoted 10 lines
    	if (IS_NOQUOTA(inode))
    		return false;
fs/f2fs/data.c +0 -2
-	if (f2fs_need_compress_data(inode))
-		return true;
    	if (wbc->sync_mode != WB_SYNC_ALL)
    		return true;
    	if (get_dirty_pages(inode) >=

SM_I(F2FS_I_SB(inode))->min_seq_blocks)

fs/f2fs/data.c +0 -0
@@ -3218,11 +3216,16 @@ static int __f2fs_write_data_pages(struct

address_space *mapping,

Quoted 21 lines
fs/f2fs/data.c +5 -0
    		mutex_lock(&sbi->writepages);
    		locked = true;
    	}
+	if (f2fs_need_compress_data(inode))
+		mutex_lock(&(F2FS_I(inode)->compress_lock));
 
    	blk_start_plug(&plug);
    	ret = f2fs_write_cache_pages(mapping, wbc, io_type);
    	blk_finish_plug(&plug);
 
+	if (f2fs_need_compress_data(inode))
+		mutex_unlock(&(F2FS_I(inode)->compress_lock));
+
    	if (locked)
    		mutex_unlock(&sbi->writepages);
 
fs/f2fs/f2fs.h index renamed from fs/f2fs/f2fs.h +0 -0

039a229e11c9..3a6587f13d2f 100644

fs/f2fs/f2fs.h struct f2fs_inode_info { · line 763

Quoted 1 line
fs/f2fs/f2fs.h +0 -0
@@ -763,6 +763,7 @@ struct f2fs_inode_info {
    	struct list_head inmem_pages;	/* inmemory pages managed by

f2fs */

fs/f2fs/super.c static struct inode *f2fs_alloc_inode(struct

Quoted 11 lines
fs/f2fs/f2fs.h +1 -0
    	struct task_struct *inmem_task;	/* store inmemory task */
    	struct mutex inmem_lock;	/* lock for inmemory pages */
+	struct mutex compress_lock;	/* lock for compress file */
    	struct extent_tree *extent_tree;	/* cached extent_tree entry */
 
    	/* avoid racing between foreground op and gc */ diff --git

a/fs/f2fs/super.c b/fs/f2fs/super.c index a133932333c5..8566e9c34540 100644

fs/f2fs/super.c +0 -0
@@ -1323,6 +1323,7 @@ static struct inode *f2fs_alloc_inode(struct

super_block *sb)

Quoted 26 lines
fs/f2fs/super.c +1 -1
    	INIT_LIST_HEAD(&fi->inmem_ilist);
    	INIT_LIST_HEAD(&fi->inmem_pages);
    	mutex_init(&fi->inmem_lock);
+	mutex_init(&fi->compress_lock);
    	init_rwsem(&fi->i_gc_rwsem[READ]);
    	init_rwsem(&fi->i_gc_rwsem[WRITE]);
    	init_rwsem(&fi->i_xattr_sem);
--
Quoted 18 lines

-----Original Message-----
From: 常凤楠
Sent: Monday, November 8, 2021 11:55 AM
To: [email protected]; [email protected]
Cc: [email protected]
Subject: Do we need serial io for compress file?

In my test, serial io for compress file will make multithread small write performance drop a lot.

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why we should do this for compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread is ok. So I think maybe we should use another lock to allow write different files in multithread.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer
#9 lore raw
In reply to Fengnan Chang
Quoted 5 lines · Fengnan Chang

In my test, serial io for compress file will make multithread small write performance drop a lot.

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why we should do this for

It was introduced to avoid fragmentation of file blocks.

Quoted 1 line

compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread

What do you mean by "write same file in multithread will have problem"?

Thanks,

Quoted 2 lines

is ok. So I think maybe we should use another lock to allow write different files in multithread.

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

A message that is not in the archive (sent off-list or not yet received): AOQAuQAvE4gDy5nrp7t7Q4pj.9.1636381271838.Hmail.changfengnan@vivo.com

author
#11 lore raw
Quoted 11 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Chao Yu
Sent: Monday, November 8, 2021 10:21 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

On 2021/11/8 11:54, Fengnan Chang wrote:

Quoted 8 lines
Quoted 6 lines

In my test, serial io for compress file will make multithread small write performance drop a lot.

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why we should do this for

It was introduced to avoid fragmentation of file blocks.

So, for small write on compress file, is this still necessary? I think we should treat compress file as regular file.

Quoted 6 lines
Quoted 4 lines

compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread

What do you mean by "write same file in multithread will have problem"?

If just remove compress file in __should_serialize_io()

fs/f2fs/data.c +2 -2
index f4fd6c246c9a..7bd429b46429 100644
@@ -3165,8 +3165,8 @@ static inline bool __should_serialize_io(struct inode *inode,
        if (IS_NOQUOTA(inode))
                return false;
 
-       if (f2fs_need_compress_data(inode))
-               return true;
+       //if (f2fs_need_compress_data(inode))
+       //      return true;
        if (wbc->sync_mode != WB_SYNC_ALL)
                return true;
        if (get_dirty_pages(inode) >= SM_I(F2FS_I_SB(inode))->min_seq_blocks)

and use fio to start multi thread to write same file, fio will hung. fio.conf:
[global]
direct=1
numjobs=8
time_based
runtime=30
ioengine=sync
iodepth=16
buffer_pattern="ZZZZ"
fsync=1

[file0]
name=fio-rand-RW
filename=fio-rand-RW
rw=rw
rwmixread=60
rwmixwrite=40
bs=1M
size=64M

[file1]
name=fio-rand-RW
filename=fio-rand-RW
rw=randrw
rwmixread=60
rwmixwrite=40
bs=4K
size=64M

Quoted 6 lines

Thanks,

Quoted 1 line

is ok. So I think maybe we should use another lock to allow write

different files in multithread.

Quoted 1 line

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer
#12 lore raw
Quoted 14 lines · 常凤楠
Quoted 14 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Chao Yu
Sent: Monday, November 8, 2021 10:21 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 3 lines · Fengnan Chang

In my test, serial io for compress file will make multithread small write performance drop a lot.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why we should do this for

It was introduced to avoid fragmentation of file blocks.

So, for small write on compress file, is this still necessary? I think we should treat compress file as regular file.

Any real scenario there? let me know if I missed any cases, as I saw, most compressible files are not small...

Quoted 25 lines
Quoted 6 lines
Quoted 4 lines

compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread

What do you mean by "write same file in multithread will have problem"?

If just remove compress file in __should_serialize_io()

fs/f2fs/data.c +2 -2
index f4fd6c246c9a..7bd429b46429 100644
@@ -3165,8 +3165,8 @@ static inline bool __should_serialize_io(struct inode *inode,
         if (IS_NOQUOTA(inode))
                 return false;
 
-       if (f2fs_need_compress_data(inode))
-               return true;
+       //if (f2fs_need_compress_data(inode))
+       //      return true;
         if (wbc->sync_mode != WB_SYNC_ALL)
                 return true;
         if (get_dirty_pages(inode) >= SM_I(F2FS_I_SB(inode))->min_seq_blocks)
Quoted 1 line

and use fio to start multi thread to write same file, fio will hung.

Any potential hangtask issue there? did you get any stack backtrace log?

If there is, it needs to figure out the root cause.

Thanks,

Quoted 20 lines

fio.conf:
[global]
direct=1
numjobs=8
time_based
runtime=30
ioengine=sync
iodepth=16
buffer_pattern="ZZZZ"
fsync=1

[file0]
name=fio-rand-RW
filename=fio-rand-RW
rw=rw
rwmixread=60
rwmixwrite=40
bs=1M
size=64M

Quoted 15 lines

[file1]
name=fio-rand-RW
filename=fio-rand-RW
rw=randrw
rwmixread=60
rwmixwrite=40
bs=4K
size=64M

Quoted 6 lines

Thanks,

Quoted 1 line

is ok. So I think maybe we should use another lock to allow write

different files in multithread.

Quoted 1 line

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

A message that is not in the archive (sent off-list or not yet received): ACQA0AB6E*[email protected]

author
#14 lore raw
Quoted 31 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Chao Yu
Sent: Tuesday, November 9, 2021 9:41 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 4 lines · 常凤楠
Quoted 4 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf

Of Chao

Quoted 15 lines
Quoted 15 lines

Yu
Sent: Monday, November 8, 2021 10:21 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 7 lines · Fengnan Chang

In my test, serial io for compress file will make multithread small write performance drop a lot.

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why we should do this for

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

It was introduced to avoid fragmentation of file blocks.

So, for small write on compress file, is this still necessary? I think we

should treat compress file as regular file.

Any real scenario there? let me know if I missed any cases, as I saw, most compressible files are not small...

Maybe my description is incorrect, small write means write with small block size, for example 4K. When write multi compress file with bs=4k in multithread, the serialize io make performance drop a lot.

Quoted 29 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread

What do you mean by "write same file in multithread will have

problem"?

fs/f2fs/data.c static inline bool __should_serialize_io(struct

Quoted 8 lines

If just remove compress file in __should_serialize_io()

fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

f4fd6c246c9a..7bd429b46429 100644

fs/f2fs/data.c +0 -0
@@ -3165,8 +3165,8 @@ static inline bool __should_serialize_io(struct

inode *inode,

Quoted 12 lines
fs/f2fs/data.c +2 -2
         if (IS_NOQUOTA(inode))
                 return false;
 
-       if (f2fs_need_compress_data(inode))
-               return true;
+       //if (f2fs_need_compress_data(inode))
+       //      return true;
         if (wbc->sync_mode != WB_SYNC_ALL)
                 return true;
         if (get_dirty_pages(inode) >=

SM_I(F2FS_I_SB(inode))->min_seq_blocks)

Quoted 4 lines
Quoted 1 line

and use fio to start multi thread to write same file, fio will hung.

Any potential hangtask issue there? did you get any stack backtrace log?

Yes, it's quite easy to reproduce in my test.

Backtrace:
[  493.915408] INFO: task fio:479 blocked for more than 122 seconds.
[  493.915729]       Not tainted 5.15.0-rc1+ #516
[  493.915845] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  493.916265] task:fio             state:D stack:13008 pid:  479 ppid:   474 flags:0x00004000
[  493.916686] Call Trace:
[  493.917310]  __schedule+0x317/0x920
[  493.917560]  ? rcu_read_lock_sched_held+0x23/0x80
[  493.917705]  schedule+0x59/0xc0
[  493.917798]  io_schedule+0x12/0x40
[  493.917895]  __lock_page+0x141/0x230
[  493.924703]  ? filemap_invalidate_unlock_two+0x40/0x40
[  493.926404]  f2fs_write_multi_pages+0x1a7/0x9c0
[  493.926579]  f2fs_write_cache_pages+0x711/0x840
[  493.926771]  f2fs_write_data_pages+0x20e/0x3f0
[  493.926906]  ? rcu_read_lock_held_common+0xe/0x40
[  493.928305]  ? do_writepages+0xd1/0x190
[  493.928439]  do_writepages+0xd1/0x190
[  493.928551]  file_write_and_wait_range+0xa3/0xe0
[  493.928690]  f2fs_do_sync_file+0x10f/0x910
[  493.928823]  do_fsync+0x38/0x60
[  493.928924]  __x64_sys_fsync+0x10/0x20
[  493.929208]  do_syscall_64+0x3a/0x90
[  493.929327]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  493.929486] RIP: 0033:0x7f64cb26ca97
[  493.929636] RSP: 002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX: 000000000000004a
[  493.929816] RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f64cb26ca97
[  493.929975] RDX: 0000000000000000 RSI: 000056378a8ad540 RDI: 0000000000000005
[  493.931164] RBP: 00007f647e23f000 R08: 0000000000000000 R09: 00007ffe387e6170
[  493.931347] R10: 00007ffe387e61b0 R11: 0000000000000293 R12: 0000000000000003
[  493.931517] R13: 00007f647e2836d8 R14: 0000000000000000 R15: 000056378a8ad568
[  493.931802] INFO: task fio:480 blocked for more than 122 seconds.
[  493.931946]       Not tainted 5.15.0-rc1+ #516
[  493.932202] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  493.932382] task:fio             state:D stack:13216 pid:  480 ppid:   474 flags:0x00000000
[  493.932596] Call Trace:
[  493.932681]  __schedule+0x317/0x920
[  493.932796]  ? rcu_read_lock_sched_held+0x23/0x80
[  493.932939]  schedule+0x59/0xc0
[  493.933180]  io_schedule+0x12/0x40
[  493.933285]  __lock_page+0x141/0x230
[  493.933391]  ? filemap_invalidate_unlock_two+0x40/0x40
[  493.933539]  f2fs_write_cache_pages+0x38a/0x840
[  493.933708]  ? do_writepages+0xd1/0x190
[  493.933821]  ? do_writepages+0xd1/0x190
[  493.933939]  f2fs_write_data_pages+0x20e/0x3f0
[  493.935516]  ? rcu_read_lock_held_common+0xe/0x40
[  493.935682]  ? do_writepages+0xd1/0x190
[  493.935790]  do_writepages+0xd1/0x190
[  493.935895]  file_write_and_wait_range+0xa3/0xe0
[  493.938074]  f2fs_do_sync_file+0x10f/0x910
[  493.938225]  do_fsync+0x38/0x60
[  493.938328]  __x64_sys_fsync+0x10/0x20
[  493.938430]  do_syscall_64+0x3a/0x90
[  493.938548]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  493.938683] RIP: 0033:0x7f64cb26ca97
[  493.938783] RSP: 002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX: 000000000000004a
[  493.938969] RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f64cb26ca97
[  493.940413] RDX: 0000000000000000 RSI: 000056378a8ad540 RDI: 0000000000000005
[  493.940591] RBP: 00007f647e283a10 R08: 0000000000000000 R09: 00007ffe387e6170
[  493.940759] R10: 00007ffe387e61b0 R11: 0000000000000293 R12: 0000000000000003
[  493.940924] R13: 00007f647e2c80e8 R14: 0000000000000000 R15: 000056378a8ad568
[  493.941341] INFO: lockdep is turned off.
[  616.796413] INFO: task fio:479 blocked for more than 245 seconds.
[  616.796706]       Not tainted 5.15.0-rc1+ #516
[  616.796824] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  616.827081] task:fio             state:D stack:13008 pid:  479 ppid:   474 flags:0x00004000
[  616.841373] Call Trace:
[  616.841492]  __schedule+0x317/0x920
[  616.841635]  ? rcu_read_lock_sched_held+0x23/0x80
[  616.841767]  schedule+0x59/0xc0
[  616.841858]  io_schedule+0x12/0x40
[  616.841952]  __lock_page+0x141/0x230
[  616.852135]  ? filemap_invalidate_unlock_two+0x40/0x40
[  616.852305]  f2fs_write_multi_pages+0x1a7/0x9c0
[  616.852455]  f2fs_write_cache_pages+0x711/0x840
[  616.852661]  f2fs_write_data_pages+0x20e/0x3f0
[  616.852785]  ? rcu_read_lock_held_common+0xe/0x40
[  616.852924]  ? do_writepages+0xd1/0x190
[  616.853281]  do_writepages+0xd1/0x190
[  616.853409]  file_write_and_wait_range+0xa3/0xe0
[  616.853537]  f2fs_do_sync_file+0x10f/0x910
[  616.853670]  do_fsync+0x38/0x60
[  616.853773]  __x64_sys_fsync+0x10/0x20
[  616.853869]  do_syscall_64+0x3a/0x90
[  616.853971]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  616.863145] RIP: 0033:0x7f64cb26ca97
[  616.863273] RSP: 002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX: 000000000000004a
[  616.863468] RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f64cb26ca97
[  616.863635] RDX: 0000000000000000 RSI: 000056378a8ad540 RDI: 0000000000000005
[  616.863803] RBP: 00007f647e23f000 R08: 0000000000000000 R09: 00007ffe387e6170
[  616.863975] R10: 00007ffe387e61b0 R11: 0000000000000293 R12: 0000000000000003
[  616.870147] R13: 00007f647e2836d8 R14: 0000000000000000 R15: 000056378a8ad568
[  616.870388] INFO: task fio:480 blocked for more than 245 seconds.
[  616.870537]       Not tainted 5.15.0-rc1+ #516
[  616.870650] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  616.870833] task:fio             state:D stack:13216 pid:  480 ppid:   474 flags:0x00000000
[  616.872161] Call Trace:
[  616.872257]  __schedule+0x317/0x920
[  616.872366]  ? rcu_read_lock_sched_held+0x23/0x80
[  616.872503]  schedule+0x59/0xc0
[  616.872596]  io_schedule+0x12/0x40
[  616.872694]  __lock_page+0x141/0x230
[  616.872803]  ? filemap_invalidate_unlock_two+0x40/0x40
[  616.872945]  f2fs_write_cache_pages+0x38a/0x840
[  616.873331]  ? do_writepages+0xd1/0x190
[  616.873448]  ? do_writepages+0xd1/0x190
[  616.873569]  f2fs_write_data_pages+0x20e/0x3f0
[  616.873694]  ? rcu_read_lock_held_common+0xe/0x40
[  616.873833]  ? do_writepages+0xd1/0x190
[  616.873936]  do_writepages+0xd1/0x190
[  616.874272]  file_write_and_wait_range+0xa3/0xe0
[  616.874424]  f2fs_do_sync_file+0x10f/0x910
[  616.874560]  do_fsync+0x38/0x60
[  616.874660]  __x64_sys_fsync+0x10/0x20
[  616.874759]  do_syscall_64+0x3a/0x90
[  616.874863]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  616.875792] RIP: 0033:0x7f64cb26ca97
[  616.875905] RSP: 002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX: 000000000000004a
[  616.876345] RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f64cb26ca97
[  616.876515] RDX: 0000000000000000 RSI: 000056378a8ad540 RDI: 0000000000000005
[  616.876692] RBP: 00007f647e283a10 R08: 0000000000000000 R09: 00007ffe387e6170
[  616.876859] R10: 00007ffe387e61b0 R11: 0000000000000293 R12: 0000000000000003
[  616.877231] R13: 00007f647e2c80e8 R14: 0000000000000000 R15: 000056378a8ad568
[  616.877456] INFO: lockdep is turned off.
Quoted 39 lines

If there is, it needs to figure out the root cause.

Thanks,

Quoted 35 lines

fio.conf:
[global]
direct=1
numjobs=8
time_based
runtime=30
ioengine=sync
iodepth=16
buffer_pattern="ZZZZ"
fsync=1

[file0]
name=fio-rand-RW
filename=fio-rand-RW
rw=rw
rwmixread=60
rwmixwrite=40
bs=1M
size=64M

[file1]
name=fio-rand-RW
filename=fio-rand-RW
rw=randrw
rwmixread=60
rwmixwrite=40
bs=4K
size=64M

Quoted 6 lines

Thanks,

Quoted 1 line

is ok. So I think maybe we should use another lock to allow write

different files in multithread.

Quoted 1 line

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer
#15 lore raw
Quoted 33 lines · 常凤楠
Quoted 33 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Chao Yu
Sent: Tuesday, November 9, 2021 9:41 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 4 lines · 常凤楠
Quoted 4 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf

Of Chao

Quoted 17 lines
Quoted 16 lines

Yu
Sent: Monday, November 8, 2021 10:21 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 7 lines · Fengnan Chang

In my test, serial io for compress file will make multithread small write performance drop a lot.

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why we should do this for

It was introduced to avoid fragmentation of file blocks.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

So, for small write on compress file, is this still necessary? I think we

should treat compress file as regular file.

Any real scenario there? let me know if I missed any cases, as I saw, most compressible files are not small...

Maybe my description is incorrect, small write means write with small block size, for example 4K. When write multi compress file with bs=4k in multithread, the serialize io make performance drop a lot.

Got it, but I mean what the real usercase is... rather than benchmark scenario.

Quoted 30 lines
Quoted 30 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread

What do you mean by "write same file in multithread will have

problem"?

fs/f2fs/data.c static inline bool __should_serialize_io(struct

Quoted 8 lines

If just remove compress file in __should_serialize_io()

fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

f4fd6c246c9a..7bd429b46429 100644

fs/f2fs/data.c +0 -0
@@ -3165,8 +3165,8 @@ static inline bool __should_serialize_io(struct

inode *inode,

Quoted 12 lines
fs/f2fs/data.c +2 -2
          if (IS_NOQUOTA(inode))
                  return false;
 
-       if (f2fs_need_compress_data(inode))
-               return true;
+       //if (f2fs_need_compress_data(inode))
+       //      return true;
          if (wbc->sync_mode != WB_SYNC_ALL)
                  return true;
          if (get_dirty_pages(inode) >=

SM_I(F2FS_I_SB(inode))->min_seq_blocks)

Quoted 5 lines
Quoted 4 lines
Quoted 1 line

and use fio to start multi thread to write same file, fio will hung.

Any potential hangtask issue there? did you get any stack backtrace log?

Yes, it's quite easy to reproduce in my test.

What's your testcase? and filesystem configuration?

Thanks,

Quoted 117 lines
Backtrace:
[  493.915408] INFO: task fio:479 blocked for more than 122 seconds.
[  493.915729]       Not tainted 5.15.0-rc1+ #516
[  493.915845] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  493.916265] task:fio             state:D stack:13008 pid:  479 ppid:   474 flags:0x00004000
[  493.916686] Call Trace:
[  493.917310]  __schedule+0x317/0x920
[  493.917560]  ? rcu_read_lock_sched_held+0x23/0x80
[  493.917705]  schedule+0x59/0xc0
[  493.917798]  io_schedule+0x12/0x40
[  493.917895]  __lock_page+0x141/0x230
[  493.924703]  ? filemap_invalidate_unlock_two+0x40/0x40
[  493.926404]  f2fs_write_multi_pages+0x1a7/0x9c0
[  493.926579]  f2fs_write_cache_pages+0x711/0x840
[  493.926771]  f2fs_write_data_pages+0x20e/0x3f0
[  493.926906]  ? rcu_read_lock_held_common+0xe/0x40
[  493.928305]  ? do_writepages+0xd1/0x190
[  493.928439]  do_writepages+0xd1/0x190
[  493.928551]  file_write_and_wait_range+0xa3/0xe0
[  493.928690]  f2fs_do_sync_file+0x10f/0x910
[  493.928823]  do_fsync+0x38/0x60
[  493.928924]  __x64_sys_fsync+0x10/0x20
[  493.929208]  do_syscall_64+0x3a/0x90
[  493.929327]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  493.929486] RIP: 0033:0x7f64cb26ca97
[  493.929636] RSP: 002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX: 000000000000004a
[  493.929816] RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f64cb26ca97
[  493.929975] RDX: 0000000000000000 RSI: 000056378a8ad540 RDI: 0000000000000005
[  493.931164] RBP: 00007f647e23f000 R08: 0000000000000000 R09: 00007ffe387e6170
[  493.931347] R10: 00007ffe387e61b0 R11: 0000000000000293 R12: 0000000000000003
[  493.931517] R13: 00007f647e2836d8 R14: 0000000000000000 R15: 000056378a8ad568
[  493.931802] INFO: task fio:480 blocked for more than 122 seconds.
[  493.931946]       Not tainted 5.15.0-rc1+ #516
[  493.932202] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  493.932382] task:fio             state:D stack:13216 pid:  480 ppid:   474 flags:0x00000000
[  493.932596] Call Trace:
[  493.932681]  __schedule+0x317/0x920
[  493.932796]  ? rcu_read_lock_sched_held+0x23/0x80
[  493.932939]  schedule+0x59/0xc0
[  493.933180]  io_schedule+0x12/0x40
[  493.933285]  __lock_page+0x141/0x230
[  493.933391]  ? filemap_invalidate_unlock_two+0x40/0x40
[  493.933539]  f2fs_write_cache_pages+0x38a/0x840
[  493.933708]  ? do_writepages+0xd1/0x190
[  493.933821]  ? do_writepages+0xd1/0x190
[  493.933939]  f2fs_write_data_pages+0x20e/0x3f0
[  493.935516]  ? rcu_read_lock_held_common+0xe/0x40
[  493.935682]  ? do_writepages+0xd1/0x190
[  493.935790]  do_writepages+0xd1/0x190
[  493.935895]  file_write_and_wait_range+0xa3/0xe0
[  493.938074]  f2fs_do_sync_file+0x10f/0x910
[  493.938225]  do_fsync+0x38/0x60
[  493.938328]  __x64_sys_fsync+0x10/0x20
[  493.938430]  do_syscall_64+0x3a/0x90
[  493.938548]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  493.938683] RIP: 0033:0x7f64cb26ca97
[  493.938783] RSP: 002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX: 000000000000004a
[  493.938969] RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f64cb26ca97
[  493.940413] RDX: 0000000000000000 RSI: 000056378a8ad540 RDI: 0000000000000005
[  493.940591] RBP: 00007f647e283a10 R08: 0000000000000000 R09: 00007ffe387e6170
[  493.940759] R10: 00007ffe387e61b0 R11: 0000000000000293 R12: 0000000000000003
[  493.940924] R13: 00007f647e2c80e8 R14: 0000000000000000 R15: 000056378a8ad568
[  493.941341] INFO: lockdep is turned off.
[  616.796413] INFO: task fio:479 blocked for more than 245 seconds.
[  616.796706]       Not tainted 5.15.0-rc1+ #516
[  616.796824] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  616.827081] task:fio             state:D stack:13008 pid:  479 ppid:   474 flags:0x00004000
[  616.841373] Call Trace:
[  616.841492]  __schedule+0x317/0x920
[  616.841635]  ? rcu_read_lock_sched_held+0x23/0x80
[  616.841767]  schedule+0x59/0xc0
[  616.841858]  io_schedule+0x12/0x40
[  616.841952]  __lock_page+0x141/0x230
[  616.852135]  ? filemap_invalidate_unlock_two+0x40/0x40
[  616.852305]  f2fs_write_multi_pages+0x1a7/0x9c0
[  616.852455]  f2fs_write_cache_pages+0x711/0x840
[  616.852661]  f2fs_write_data_pages+0x20e/0x3f0
[  616.852785]  ? rcu_read_lock_held_common+0xe/0x40
[  616.852924]  ? do_writepages+0xd1/0x190
[  616.853281]  do_writepages+0xd1/0x190
[  616.853409]  file_write_and_wait_range+0xa3/0xe0
[  616.853537]  f2fs_do_sync_file+0x10f/0x910
[  616.853670]  do_fsync+0x38/0x60
[  616.853773]  __x64_sys_fsync+0x10/0x20
[  616.853869]  do_syscall_64+0x3a/0x90
[  616.853971]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  616.863145] RIP: 0033:0x7f64cb26ca97
[  616.863273] RSP: 002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX: 000000000000004a
[  616.863468] RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f64cb26ca97
[  616.863635] RDX: 0000000000000000 RSI: 000056378a8ad540 RDI: 0000000000000005
[  616.863803] RBP: 00007f647e23f000 R08: 0000000000000000 R09: 00007ffe387e6170
[  616.863975] R10: 00007ffe387e61b0 R11: 0000000000000293 R12: 0000000000000003
[  616.870147] R13: 00007f647e2836d8 R14: 0000000000000000 R15: 000056378a8ad568
[  616.870388] INFO: task fio:480 blocked for more than 245 seconds.
[  616.870537]       Not tainted 5.15.0-rc1+ #516
[  616.870650] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  616.870833] task:fio             state:D stack:13216 pid:  480 ppid:   474 flags:0x00000000
[  616.872161] Call Trace:
[  616.872257]  __schedule+0x317/0x920
[  616.872366]  ? rcu_read_lock_sched_held+0x23/0x80
[  616.872503]  schedule+0x59/0xc0
[  616.872596]  io_schedule+0x12/0x40
[  616.872694]  __lock_page+0x141/0x230
[  616.872803]  ? filemap_invalidate_unlock_two+0x40/0x40
[  616.872945]  f2fs_write_cache_pages+0x38a/0x840
[  616.873331]  ? do_writepages+0xd1/0x190
[  616.873448]  ? do_writepages+0xd1/0x190
[  616.873569]  f2fs_write_data_pages+0x20e/0x3f0
[  616.873694]  ? rcu_read_lock_held_common+0xe/0x40
[  616.873833]  ? do_writepages+0xd1/0x190
[  616.873936]  do_writepages+0xd1/0x190
[  616.874272]  file_write_and_wait_range+0xa3/0xe0
[  616.874424]  f2fs_do_sync_file+0x10f/0x910
[  616.874560]  do_fsync+0x38/0x60
[  616.874660]  __x64_sys_fsync+0x10/0x20
[  616.874759]  do_syscall_64+0x3a/0x90
[  616.874863]  entry_SYSCALL_64_after_hwframe+0x44/0xae
Quoted 47 lines
[  616.875792] RIP: 0033:0x7f64cb26ca97
[  616.875905] RSP: 002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX: 000000000000004a
[  616.876345] RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f64cb26ca97
[  616.876515] RDX: 0000000000000000 RSI: 000056378a8ad540 RDI: 0000000000000005
[  616.876692] RBP: 00007f647e283a10 R08: 0000000000000000 R09: 00007ffe387e6170
[  616.876859] R10: 00007ffe387e61b0 R11: 0000000000000293 R12: 0000000000000003
[  616.877231] R13: 00007f647e2c80e8 R14: 0000000000000000 R15: 000056378a8ad568
[  616.877456] INFO: lockdep is turned off.
Quoted 39 lines

If there is, it needs to figure out the root cause.

Thanks,

Quoted 35 lines

fio.conf:
[global]
direct=1
numjobs=8
time_based
runtime=30
ioengine=sync
iodepth=16
buffer_pattern="ZZZZ"
fsync=1

[file0]
name=fio-rand-RW
filename=fio-rand-RW
rw=rw
rwmixread=60
rwmixwrite=40
bs=1M
size=64M

[file1]
name=fio-rand-RW
filename=fio-rand-RW
rw=randrw
rwmixread=60
rwmixwrite=40
bs=4K
size=64M

Quoted 6 lines

Thanks,

Quoted 1 line

is ok. So I think maybe we should use another lock to allow write

different files in multithread.

Quoted 1 line

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

A message that is not in the archive (sent off-list or not yet received): AIIAVAAPE7EN6BQe5FH43Kp3.9.1636784464708.Hmail.changfengnan@vivo.com

A message that is not in the archive (sent off-list or not yet received): KL1PR0601MB40038EBE3EE038926365F40DBB989@KL1PR0601MB4003.apcprd06.prod.outlook.com

maintainer
#18 lore raw
Quoted 52 lines · 常凤楠
Quoted 52 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Chao Yu
Sent: Saturday, November 13, 2021 2:21 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 4 lines · 常凤楠
Quoted 4 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf

Of Chao

Quoted 11 lines
Quoted 11 lines

Yu
Sent: Tuesday, November 9, 2021 9:41 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 4 lines · 常凤楠
Quoted 4 lines

-----Original Message-----
From: [email protected] <[email protected]> On

Behalf

Quoted 26 lines
Quoted 16 lines

Of Chao

Quoted 15 lines
Quoted 15 lines

Yu
Sent: Monday, November 8, 2021 10:21 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 7 lines · Fengnan Chang

In my test, serial io for compress file will make multithread small write performance drop a lot.

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why we should do this for

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

It was introduced to avoid fragmentation of file blocks.

So, for small write on compress file, is this still necessary? I think we

should treat compress file as regular file.

Any real scenario there? let me know if I missed any cases, as I saw, most compressible files are not small...

Maybe my description is incorrect, small write means write with small

Quoted 8 lines
Quoted 6 lines

block size, for example 4K.

Quoted 1 line

When write multi compress file with bs=4k in multithread, the serialize

io make performance drop a lot.

Got it, but I mean what the real usercase is... rather than benchmark scenario.

I think it’s quite common user case if we take compress file as normal file to use,

Well, I mean what's the type of file that you want to compress, and which apps will use them? and what's the IO model runs on compressed file?

Thanks,

Quoted 42 lines

write multi file with bs < cluster size at same time will be bothered by this issue.

Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines

compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread

What do you mean by "write same file in multithread will have

problem"?

Quoted 9 lines

If just remove compress file in __should_serialize_io()

fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

f4fd6c246c9a..7bd429b46429 100644

fs/f2fs/data.c +0 -0
@@ -3165,8 +3165,8 @@ static inline bool

__should_serialize_io(struct

inode *inode,

Quoted 12 lines
           if (IS_NOQUOTA(inode))
                   return false;
fs/f2fs/data.c +2 -2
-       if (f2fs_need_compress_data(inode))
-               return true;
+       //if (f2fs_need_compress_data(inode))
+       //      return true;
           if (wbc->sync_mode != WB_SYNC_ALL)
                   return true;
           if (get_dirty_pages(inode) >=

SM_I(F2FS_I_SB(inode))->min_seq_blocks)

Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

and use fio to start multi thread to write same file, fio will hung.

Any potential hangtask issue there? did you get any stack backtrace log?

Yes, it's quite easy to reproduce in my test.

What's your testcase? and filesystem configuration?

Quoted 198 lines

The test case as below fio conf. filesystem configure, the whole kernel config as attached config.rar file. CONFIG_F2FS_FS=y
CONFIG_F2FS_STAT_FS=y
CONFIG_F2FS_FS_XATTR=y
CONFIG_F2FS_FS_POSIX_ACL=y
CONFIG_F2FS_FS_SECURITY=y
CONFIG_F2FS_CHECK_FS=y
CONFIG_F2FS_FAULT_INJECTION=y
CONFIG_F2FS_FS_COMPRESSION=y
CONFIG_F2FS_FS_LZO=y
CONFIG_F2FS_FS_LZORLE=y
CONFIG_F2FS_FS_LZ4=y
CONFIG_F2FS_FS_LZ4HC=y
CONFIG_F2FS_FS_ZSTD=y
CONFIG_F2FS_IOSTAT=y

Quoted 183 lines

Thanks,

Quoted 4 lines
Backtrace:
[  493.915408] INFO: task fio:479 blocked for more than 122 seconds.
[  493.915729]       Not tainted 5.15.0-rc1+ #516
[  493.915845] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"

disables this message.

Quoted 1 line
[  493.916265] task:fio             state:D stack:13008 pid:  479 ppid:

474 flags:0x00004000

Quoted 19 lines
[  493.916686] Call Trace:
[  493.917310]  __schedule+0x317/0x920 [  493.917560]  ?
rcu_read_lock_sched_held+0x23/0x80
[  493.917705]  schedule+0x59/0xc0
[  493.917798]  io_schedule+0x12/0x40
[  493.917895]  __lock_page+0x141/0x230 [  493.924703]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  493.926404]  f2fs_write_multi_pages+0x1a7/0x9c0
[  493.926579]  f2fs_write_cache_pages+0x711/0x840
[  493.926771]  f2fs_write_data_pages+0x20e/0x3f0 [  493.926906]  ?
rcu_read_lock_held_common+0xe/0x40
[  493.928305]  ? do_writepages+0xd1/0x190 [  493.928439]
do_writepages+0xd1/0x190 [  493.928551]
file_write_and_wait_range+0xa3/0xe0
[  493.928690]  f2fs_do_sync_file+0x10f/0x910 [  493.928823]
do_fsync+0x38/0x60 [  493.928924]  __x64_sys_fsync+0x10/0x20 [
493.929208]  do_syscall_64+0x3a/0x90 [  493.929327]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  493.929486] RIP: 0033:0x7f64cb26ca97 [  493.929636] RSP:
Quoted 1 line

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

000000000000004a [

Quoted 6 lines

493.929816] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 493.929975] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 493.931164] RBP:
00007f647e23f000 R08: 0000000000000000 R09: 00007ffe387e6170 [ 493.931347] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 493.931517] R13: 00007f647e2836d8 R14:

0000000000000000 R15: 000056378a8ad568 [ 493.931802] INFO: task fio:480 blocked for more than 122 seconds.

Quoted 2 lines
[  493.931946]       Not tainted 5.15.0-rc1+ #516
[  493.932202] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"

disables this message.

Quoted 1 line
[  493.932382] task:fio             state:D stack:13216 pid:  480 ppid:

474 flags:0x00000000

Quoted 20 lines
[  493.932596] Call Trace:
[  493.932681]  __schedule+0x317/0x920 [  493.932796]  ?
rcu_read_lock_sched_held+0x23/0x80
[  493.932939]  schedule+0x59/0xc0
[  493.933180]  io_schedule+0x12/0x40
[  493.933285]  __lock_page+0x141/0x230 [  493.933391]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  493.933539]  f2fs_write_cache_pages+0x38a/0x840
[  493.933708]  ? do_writepages+0xd1/0x190 [  493.933821]  ?
do_writepages+0xd1/0x190 [  493.933939]
f2fs_write_data_pages+0x20e/0x3f0 [  493.935516]  ?
rcu_read_lock_held_common+0xe/0x40
[  493.935682]  ? do_writepages+0xd1/0x190 [  493.935790]
do_writepages+0xd1/0x190 [  493.935895]
file_write_and_wait_range+0xa3/0xe0
[  493.938074]  f2fs_do_sync_file+0x10f/0x910 [  493.938225]
do_fsync+0x38/0x60 [  493.938328]  __x64_sys_fsync+0x10/0x20 [
493.938430]  do_syscall_64+0x3a/0x90 [  493.938548]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  493.938683] RIP: 0033:0x7f64cb26ca97 [  493.938783] RSP:
Quoted 1 line

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

000000000000004a [

Quoted 6 lines

493.938969] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 493.940413] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 493.940591] RBP:
00007f647e283a10 R08: 0000000000000000 R09: 00007ffe387e6170 [ 493.940759] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 493.940924] R13: 00007f647e2c80e8 R14:

0000000000000000 R15: 000056378a8ad568 [ 493.941341] INFO: lockdep is turned off.

Quoted 3 lines
[  616.796413] INFO: task fio:479 blocked for more than 245 seconds.
[  616.796706]       Not tainted 5.15.0-rc1+ #516
[  616.796824] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"

disables this message.

Quoted 1 line
[  616.827081] task:fio             state:D stack:13008 pid:  479 ppid:

474 flags:0x00004000

Quoted 19 lines
[  616.841373] Call Trace:
[  616.841492]  __schedule+0x317/0x920 [  616.841635]  ?
rcu_read_lock_sched_held+0x23/0x80
[  616.841767]  schedule+0x59/0xc0
[  616.841858]  io_schedule+0x12/0x40
[  616.841952]  __lock_page+0x141/0x230 [  616.852135]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  616.852305]  f2fs_write_multi_pages+0x1a7/0x9c0
[  616.852455]  f2fs_write_cache_pages+0x711/0x840
[  616.852661]  f2fs_write_data_pages+0x20e/0x3f0 [  616.852785]  ?
rcu_read_lock_held_common+0xe/0x40
[  616.852924]  ? do_writepages+0xd1/0x190 [  616.853281]
do_writepages+0xd1/0x190 [  616.853409]
file_write_and_wait_range+0xa3/0xe0
[  616.853537]  f2fs_do_sync_file+0x10f/0x910 [  616.853670]
do_fsync+0x38/0x60 [  616.853773]  __x64_sys_fsync+0x10/0x20 [
616.853869]  do_syscall_64+0x3a/0x90 [  616.853971]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  616.863145] RIP: 0033:0x7f64cb26ca97 [  616.863273] RSP:
Quoted 1 line

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

000000000000004a [

Quoted 6 lines

616.863468] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 616.863635] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 616.863803] RBP:
00007f647e23f000 R08: 0000000000000000 R09: 00007ffe387e6170 [ 616.863975] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 616.870147] R13: 00007f647e2836d8 R14:

0000000000000000 R15: 000056378a8ad568 [ 616.870388] INFO: task fio:480 blocked for more than 245 seconds.

Quoted 2 lines
[  616.870537]       Not tainted 5.15.0-rc1+ #516
[  616.870650] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"

disables this message.

Quoted 1 line
[  616.870833] task:fio             state:D stack:13216 pid:  480 ppid:

474 flags:0x00000000

Quoted 20 lines
[  616.872161] Call Trace:
[  616.872257]  __schedule+0x317/0x920 [  616.872366]  ?
rcu_read_lock_sched_held+0x23/0x80
[  616.872503]  schedule+0x59/0xc0
[  616.872596]  io_schedule+0x12/0x40
[  616.872694]  __lock_page+0x141/0x230 [  616.872803]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  616.872945]  f2fs_write_cache_pages+0x38a/0x840
[  616.873331]  ? do_writepages+0xd1/0x190 [  616.873448]  ?
do_writepages+0xd1/0x190 [  616.873569]
f2fs_write_data_pages+0x20e/0x3f0 [  616.873694]  ?
rcu_read_lock_held_common+0xe/0x40
[  616.873833]  ? do_writepages+0xd1/0x190 [  616.873936]
do_writepages+0xd1/0x190 [  616.874272]
file_write_and_wait_range+0xa3/0xe0
[  616.874424]  f2fs_do_sync_file+0x10f/0x910 [  616.874560]
do_fsync+0x38/0x60 [  616.874660]  __x64_sys_fsync+0x10/0x20 [
616.874759]  do_syscall_64+0x3a/0x90 [  616.874863]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  616.875792] RIP: 0033:0x7f64cb26ca97 [  616.875905] RSP:
Quoted 1 line

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

000000000000004a [

Quoted 6 lines

616.876345] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 616.876515] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 616.876692] RBP:
00007f647e283a10 R08: 0000000000000000 R09: 00007ffe387e6170 [ 616.876859] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 616.877231] R13: 00007f647e2c80e8 R14:

0000000000000000 R15: 000056378a8ad568 [ 616.877456] INFO: lockdep is turned off.

Quoted 39 lines
Quoted 39 lines

If there is, it needs to figure out the root cause.

Thanks,

Quoted 35 lines

fio.conf:
[global]
direct=1
numjobs=8
time_based
runtime=30
ioengine=sync
iodepth=16
buffer_pattern="ZZZZ"
fsync=1

[file0]
name=fio-rand-RW
filename=fio-rand-RW
rw=rw
rwmixread=60
rwmixwrite=40
bs=1M
size=64M

[file1]
name=fio-rand-RW
filename=fio-rand-RW
rw=randrw
rwmixread=60
rwmixwrite=40
bs=4K
size=64M

Quoted 6 lines

Thanks,

Quoted 1 line

is ok. So I think maybe we should use another lock to allow write

different files in multithread.

Quoted 1 line

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

A message that is not in the archive (sent off-list or not yet received): AOEA7wCAE-cPtwt6leizvqr0.9.1636944422386.Hmail.changfengnan@vivo.com

author
#20 lore raw
Quoted 72 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Chao Yu
Sent: Monday, November 15, 2021 10:47 AM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 2 lines · 常凤楠
Quoted 2 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf

Of Chao

Quoted 11 lines
Quoted 11 lines

Yu
Sent: Saturday, November 13, 2021 2:21 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 4 lines · 常凤楠
Quoted 4 lines

-----Original Message-----
From: [email protected] <[email protected]> On

Behalf

Quoted 20 lines
Quoted 20 lines

Of Chao

Quoted 11 lines
Quoted 11 lines

Yu
Sent: Tuesday, November 9, 2021 9:41 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 4 lines · 常凤楠
Quoted 4 lines

-----Original Message-----
From: [email protected] <[email protected]> On

Behalf

Quoted 7 lines
Quoted 7 lines

Of Chao

Quoted 6 lines
Quoted 6 lines

Yu
Sent: Monday, November 8, 2021 10:21 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines · Fengnan Chang
Quoted 6 lines

In my test, serial io for compress file will make multithread small write performance drop a lot.

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why we should

do

Quoted 18 lines
Quoted 18 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

this for

It was introduced to avoid fragmentation of file blocks.

So, for small write on compress file, is this still necessary? I think we

Quoted 7 lines
Quoted 4 lines

should treat compress file as regular file.

Any real scenario there? let me know if I missed any cases, as I saw, most compressible files are not small...

Maybe my description is incorrect, small write means write with small

block size, for example 4K.

Quoted 2 lines

When write multi compress file with bs=4k in multithread, the serialize

io make performance drop a lot.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Got it, but I mean what the real usercase is... rather than benchmark scenario.

I think it’s quite common user case if we take compress file as normal file to use,

Well, I mean what's the type of file that you want to compress, and which apps will use them? and what's the IO model runs on compressed file?

For now, I haven't test this on normal app, I test compress file on a test app, it's try to simulate IO type of actual user case. This case is try to simulate multithread SQL performance and random write, the test file is db and no extension name file.

Quoted 206 lines

Thanks,

Quoted 1 line

write multi file with bs < cluster size at same time will be bothered by

this issue.

Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines

compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread

What do you mean by "write same file in multithread will have

problem"?

Quoted 9 lines

If just remove compress file in __should_serialize_io()

fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

f4fd6c246c9a..7bd429b46429 100644

fs/f2fs/data.c +0 -0
@@ -3165,8 +3165,8 @@ static inline bool

__should_serialize_io(struct

inode *inode,

Quoted 12 lines
           if (IS_NOQUOTA(inode))
                   return false;
fs/f2fs/data.c +2 -2
-       if (f2fs_need_compress_data(inode))
-               return true;
+       //if (f2fs_need_compress_data(inode))
+       //      return true;
           if (wbc->sync_mode != WB_SYNC_ALL)
                   return true;
           if (get_dirty_pages(inode) >=

SM_I(F2FS_I_SB(inode))->min_seq_blocks)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

and use fio to start multi thread to write same file, fio will hung.

Any potential hangtask issue there? did you get any stack backtrace

log?

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line

Yes, it's quite easy to reproduce in my test.

What's your testcase? and filesystem configuration?

The test case as below fio conf. filesystem configure, the whole kernel

config as attached config.rar file.

Quoted 6 lines

CONFIG_F2FS_FS=y
CONFIG_F2FS_STAT_FS=y
CONFIG_F2FS_FS_XATTR=y
CONFIG_F2FS_FS_POSIX_ACL=y
CONFIG_F2FS_FS_SECURITY=y
CONFIG_F2FS_CHECK_FS=y

Quoted 17 lines

CONFIG_F2FS_FAULT_INJECTION=y
CONFIG_F2FS_FS_COMPRESSION=y
CONFIG_F2FS_FS_LZO=y
CONFIG_F2FS_FS_LZORLE=y
CONFIG_F2FS_FS_LZ4=y
CONFIG_F2FS_FS_LZ4HC=y
CONFIG_F2FS_FS_ZSTD=y
CONFIG_F2FS_IOSTAT=y

Quoted 9 lines

Thanks,

Quoted 4 lines
Backtrace:
[  493.915408] INFO: task fio:479 blocked for more than 122 seconds.
[  493.915729]       Not tainted 5.15.0-rc1+ #516
[  493.915845] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"

disables this message.

Quoted 1 line
[  493.916265] task:fio             state:D stack:13008 pid:  479

ppid:

Quoted 11 lines
Quoted 11 lines

474 flags:0x00004000

Quoted 10 lines
[  493.916686] Call Trace:
[  493.917310]  __schedule+0x317/0x920 [  493.917560]  ?
rcu_read_lock_sched_held+0x23/0x80
[  493.917705]  schedule+0x59/0xc0
[  493.917798]  io_schedule+0x12/0x40 [  493.917895]
__lock_page+0x141/0x230 [  493.924703]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  493.926404]  f2fs_write_multi_pages+0x1a7/0x9c0
[  493.926579]  f2fs_write_cache_pages+0x711/0x840
[  493.926771]  f2fs_write_data_pages+0x20e/0x3f0
[  493.926906]  ?
Quoted 17 lines
Quoted 17 lines
Quoted 10 lines
rcu_read_lock_held_common+0xe/0x40
[  493.928305]  ? do_writepages+0xd1/0x190 [  493.928439]
do_writepages+0xd1/0x190 [  493.928551]
file_write_and_wait_range+0xa3/0xe0
[  493.928690]  f2fs_do_sync_file+0x10f/0x910 [  493.928823]
do_fsync+0x38/0x60 [  493.928924]  __x64_sys_fsync+0x10/0x20 [
493.929208]  do_syscall_64+0x3a/0x90 [  493.929327]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  493.929486] RIP: 0033:0x7f64cb26ca97 [  493.929636] RSP:

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

000000000000004a [

Quoted 6 lines

493.929816] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 493.929975] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 493.931164] RBP:
00007f647e23f000 R08: 0000000000000000 R09: 00007ffe387e6170 [ 493.931347] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 493.931517] R13: 00007f647e2836d8 R14:

Quoted 6 lines
Quoted 6 lines

0000000000000000 R15: 000056378a8ad568 [ 493.931802] INFO: task fio:480 blocked for more than 122 seconds.

Quoted 2 lines
[  493.931946]       Not tainted 5.15.0-rc1+ #516
[  493.932202] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"

disables this message.

Quoted 1 line
[  493.932382] task:fio             state:D stack:13216 pid:  480

ppid:

Quoted 22 lines
Quoted 22 lines

474 flags:0x00000000

Quoted 21 lines
[  493.932596] Call Trace:
[  493.932681]  __schedule+0x317/0x920 [  493.932796]  ?
rcu_read_lock_sched_held+0x23/0x80
[  493.932939]  schedule+0x59/0xc0
[  493.933180]  io_schedule+0x12/0x40 [  493.933285]
__lock_page+0x141/0x230 [  493.933391]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  493.933539]  f2fs_write_cache_pages+0x38a/0x840
[  493.933708]  ? do_writepages+0xd1/0x190 [  493.933821]  ?
do_writepages+0xd1/0x190 [  493.933939]
f2fs_write_data_pages+0x20e/0x3f0 [  493.935516]  ?
rcu_read_lock_held_common+0xe/0x40
[  493.935682]  ? do_writepages+0xd1/0x190 [  493.935790]
do_writepages+0xd1/0x190 [  493.935895]
file_write_and_wait_range+0xa3/0xe0
[  493.938074]  f2fs_do_sync_file+0x10f/0x910 [  493.938225]
do_fsync+0x38/0x60 [  493.938328]  __x64_sys_fsync+0x10/0x20 [
493.938430]  do_syscall_64+0x3a/0x90 [  493.938548]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  493.938683] RIP: 0033:0x7f64cb26ca97 [  493.938783] RSP:

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

Quoted 8 lines
Quoted 8 lines

000000000000004a [

Quoted 6 lines

493.938969] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 493.940413] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 493.940591] RBP:
00007f647e283a10 R08: 0000000000000000 R09: 00007ffe387e6170 [ 493.940759] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 493.940924] R13: 00007f647e2c80e8 R14:

0000000000000000 R15: 000056378a8ad568 [ 493.941341] INFO:

lockdep

Quoted 6 lines
Quoted 6 lines

is turned off.

Quoted 3 lines
[  616.796413] INFO: task fio:479 blocked for more than 245 seconds.
[  616.796706]       Not tainted 5.15.0-rc1+ #516
[  616.796824] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"

disables this message.

Quoted 1 line
[  616.827081] task:fio             state:D stack:13008 pid:  479

ppid:

Quoted 11 lines
Quoted 11 lines

474 flags:0x00004000

Quoted 10 lines
[  616.841373] Call Trace:
[  616.841492]  __schedule+0x317/0x920 [  616.841635]  ?
rcu_read_lock_sched_held+0x23/0x80
[  616.841767]  schedule+0x59/0xc0
[  616.841858]  io_schedule+0x12/0x40 [  616.841952]
__lock_page+0x141/0x230 [  616.852135]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  616.852305]  f2fs_write_multi_pages+0x1a7/0x9c0
[  616.852455]  f2fs_write_cache_pages+0x711/0x840
[  616.852661]  f2fs_write_data_pages+0x20e/0x3f0
[  616.852785]  ?
Quoted 17 lines
Quoted 17 lines
Quoted 10 lines
rcu_read_lock_held_common+0xe/0x40
[  616.852924]  ? do_writepages+0xd1/0x190 [  616.853281]
do_writepages+0xd1/0x190 [  616.853409]
file_write_and_wait_range+0xa3/0xe0
[  616.853537]  f2fs_do_sync_file+0x10f/0x910 [  616.853670]
do_fsync+0x38/0x60 [  616.853773]  __x64_sys_fsync+0x10/0x20 [
616.853869]  do_syscall_64+0x3a/0x90 [  616.853971]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  616.863145] RIP: 0033:0x7f64cb26ca97 [  616.863273] RSP:

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

000000000000004a [

Quoted 6 lines

616.863468] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 616.863635] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 616.863803] RBP:
00007f647e23f000 R08: 0000000000000000 R09: 00007ffe387e6170 [ 616.863975] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 616.870147] R13: 00007f647e2836d8 R14:

Quoted 6 lines
Quoted 6 lines

0000000000000000 R15: 000056378a8ad568 [ 616.870388] INFO: task fio:480 blocked for more than 245 seconds.

Quoted 2 lines
[  616.870537]       Not tainted 5.15.0-rc1+ #516
[  616.870650] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"

disables this message.

Quoted 1 line
[  616.870833] task:fio             state:D stack:13216 pid:  480

ppid:

Quoted 23 lines
Quoted 23 lines

474 flags:0x00000000

Quoted 20 lines
[  616.872161] Call Trace:
[  616.872257]  __schedule+0x317/0x920 [  616.872366]  ?
rcu_read_lock_sched_held+0x23/0x80
[  616.872503]  schedule+0x59/0xc0
[  616.872596]  io_schedule+0x12/0x40 [  616.872694]
__lock_page+0x141/0x230 [  616.872803]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  616.872945]  f2fs_write_cache_pages+0x38a/0x840
[  616.873331]  ? do_writepages+0xd1/0x190 [  616.873448]  ?
do_writepages+0xd1/0x190 [  616.873569]
f2fs_write_data_pages+0x20e/0x3f0 [  616.873694]  ?
rcu_read_lock_held_common+0xe/0x40
[  616.873833]  ? do_writepages+0xd1/0x190 [  616.873936]
do_writepages+0xd1/0x190 [  616.874272]
file_write_and_wait_range+0xa3/0xe0
[  616.874424]  f2fs_do_sync_file+0x10f/0x910 [  616.874560]
do_fsync+0x38/0x60 [  616.874660]  __x64_sys_fsync+0x10/0x20 [
616.874759]  do_syscall_64+0x3a/0x90 [  616.874863]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  616.875792] RIP: 0033:0x7f64cb26ca97 [  616.875905] RSP:
Quoted 1 line

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

000000000000004a [

Quoted 49 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

616.876345] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 616.876515] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 616.876692] RBP:
00007f647e283a10 R08: 0000000000000000 R09: 00007ffe387e6170 [ 616.876859] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 616.877231] R13: 00007f647e2c80e8 R14:

0000000000000000 R15: 000056378a8ad568 [ 616.877456] INFO:

lockdep

Quoted 41 lines
Quoted 41 lines

is turned off.

Quoted 40 lines
Quoted 40 lines

If there is, it needs to figure out the root cause.

Thanks,

Quoted 36 lines

fio.conf:
[global]
direct=1
numjobs=8
time_based
runtime=30
ioengine=sync
iodepth=16
buffer_pattern="ZZZZ"
fsync=1

[file0]
name=fio-rand-RW
filename=fio-rand-RW
rw=rw
rwmixread=60
rwmixwrite=40
bs=1M
size=64M

[file1]
name=fio-rand-RW
filename=fio-rand-RW
rw=randrw
rwmixread=60
rwmixwrite=40
bs=4K
size=64M

Quoted 7 lines

Thanks,

Quoted 2 lines

is ok. So I think maybe we should use another lock to allow write

different files in multithread.

Quoted 1 line

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

maintainer
#21 lore raw
Quoted 75 lines · 常凤楠
Quoted 75 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Chao Yu
Sent: Monday, November 15, 2021 10:47 AM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 2 lines · 常凤楠
Quoted 2 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf

Of Chao

Quoted 11 lines
Quoted 11 lines

Yu
Sent: Saturday, November 13, 2021 2:21 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 4 lines · 常凤楠
Quoted 4 lines

-----Original Message-----
From: [email protected] <[email protected]> On

Behalf

Quoted 20 lines
Quoted 20 lines

Of Chao

Quoted 11 lines
Quoted 11 lines

Yu
Sent: Tuesday, November 9, 2021 9:41 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 4 lines · 常凤楠
Quoted 4 lines

-----Original Message-----
From: [email protected] <[email protected]> On

Behalf

Quoted 7 lines
Quoted 7 lines

Of Chao

Quoted 6 lines
Quoted 6 lines

Yu
Sent: Monday, November 8, 2021 10:21 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines · Fengnan Chang
Quoted 6 lines

In my test, serial io for compress file will make multithread small write performance drop a lot.

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why we should

do

Quoted 21 lines
Quoted 20 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

this for

It was introduced to avoid fragmentation of file blocks.

So, for small write on compress file, is this still necessary? I think we

Quoted 7 lines
Quoted 4 lines

should treat compress file as regular file.

Any real scenario there? let me know if I missed any cases, as I saw, most compressible files are not small...

Maybe my description is incorrect, small write means write with small

block size, for example 4K.

Quoted 2 lines

When write multi compress file with bs=4k in multithread, the serialize

io make performance drop a lot.

Got it, but I mean what the real usercase is... rather than benchmark scenario.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I think it’s quite common user case if we take compress file as normal file to use,

Well, I mean what's the type of file that you want to compress, and which apps will use them? and what's the IO model runs on compressed file?

For now, I haven't test this on normal app, I test compress file on a test app, it's try to simulate IO type of actual user case. This case is try to simulate multithread SQL performance and random write, the test file is db and no extension name file.

Oh, IMO, SQLite is not target application scenario of f2fs compression functionality.

It may suffer performance regression due to write amplification during SQLite's random write.

Thanks,

Quoted 249 lines
Quoted 249 lines

Thanks,

Quoted 1 line

write multi file with bs < cluster size at same time will be bothered by

this issue.

Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines

compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread

What do you mean by "write same file in multithread will have

problem"?

Quoted 9 lines

If just remove compress file in __should_serialize_io()

fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

f4fd6c246c9a..7bd429b46429 100644

fs/f2fs/data.c +0 -0
@@ -3165,8 +3165,8 @@ static inline bool

__should_serialize_io(struct

inode *inode,

Quoted 12 lines
            if (IS_NOQUOTA(inode))
                    return false;
fs/f2fs/data.c +2 -2
-       if (f2fs_need_compress_data(inode))
-               return true;
+       //if (f2fs_need_compress_data(inode))
+       //      return true;
            if (wbc->sync_mode != WB_SYNC_ALL)
                    return true;
            if (get_dirty_pages(inode) >=

SM_I(F2FS_I_SB(inode))->min_seq_blocks)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

and use fio to start multi thread to write same file, fio will hung.

Any potential hangtask issue there? did you get any stack backtrace

log?

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line

Yes, it's quite easy to reproduce in my test.

What's your testcase? and filesystem configuration?

The test case as below fio conf. filesystem configure, the whole kernel

config as attached config.rar file.

Quoted 6 lines

CONFIG_F2FS_FS=y
CONFIG_F2FS_STAT_FS=y
CONFIG_F2FS_FS_XATTR=y
CONFIG_F2FS_FS_POSIX_ACL=y
CONFIG_F2FS_FS_SECURITY=y
CONFIG_F2FS_CHECK_FS=y

Quoted 17 lines

CONFIG_F2FS_FAULT_INJECTION=y
CONFIG_F2FS_FS_COMPRESSION=y
CONFIG_F2FS_FS_LZO=y
CONFIG_F2FS_FS_LZORLE=y
CONFIG_F2FS_FS_LZ4=y
CONFIG_F2FS_FS_LZ4HC=y
CONFIG_F2FS_FS_ZSTD=y
CONFIG_F2FS_IOSTAT=y

Quoted 9 lines

Thanks,

Quoted 4 lines
Backtrace:
[  493.915408] INFO: task fio:479 blocked for more than 122 seconds.
[  493.915729]       Not tainted 5.15.0-rc1+ #516
[  493.915845] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"

disables this message.

Quoted 1 line
[  493.916265] task:fio             state:D stack:13008 pid:  479

ppid:

Quoted 11 lines
Quoted 11 lines

474 flags:0x00004000

Quoted 10 lines
[  493.916686] Call Trace:
[  493.917310]  __schedule+0x317/0x920 [  493.917560]  ?
rcu_read_lock_sched_held+0x23/0x80
[  493.917705]  schedule+0x59/0xc0
[  493.917798]  io_schedule+0x12/0x40 [  493.917895]
__lock_page+0x141/0x230 [  493.924703]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  493.926404]  f2fs_write_multi_pages+0x1a7/0x9c0
[  493.926579]  f2fs_write_cache_pages+0x711/0x840
[  493.926771]  f2fs_write_data_pages+0x20e/0x3f0
[  493.926906]  ?
Quoted 17 lines
Quoted 17 lines
Quoted 10 lines
rcu_read_lock_held_common+0xe/0x40
[  493.928305]  ? do_writepages+0xd1/0x190 [  493.928439]
do_writepages+0xd1/0x190 [  493.928551]
file_write_and_wait_range+0xa3/0xe0
[  493.928690]  f2fs_do_sync_file+0x10f/0x910 [  493.928823]
do_fsync+0x38/0x60 [  493.928924]  __x64_sys_fsync+0x10/0x20 [
493.929208]  do_syscall_64+0x3a/0x90 [  493.929327]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  493.929486] RIP: 0033:0x7f64cb26ca97 [  493.929636] RSP:

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

000000000000004a [

Quoted 6 lines

493.929816] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 493.929975] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 493.931164] RBP:
00007f647e23f000 R08: 0000000000000000 R09: 00007ffe387e6170 [ 493.931347] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 493.931517] R13: 00007f647e2836d8 R14:

Quoted 6 lines
Quoted 6 lines

0000000000000000 R15: 000056378a8ad568 [ 493.931802] INFO: task fio:480 blocked for more than 122 seconds.

Quoted 2 lines
[  493.931946]       Not tainted 5.15.0-rc1+ #516
[  493.932202] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"

disables this message.

Quoted 1 line
[  493.932382] task:fio             state:D stack:13216 pid:  480

ppid:

Quoted 22 lines
Quoted 22 lines

474 flags:0x00000000

Quoted 21 lines
[  493.932596] Call Trace:
[  493.932681]  __schedule+0x317/0x920 [  493.932796]  ?
rcu_read_lock_sched_held+0x23/0x80
[  493.932939]  schedule+0x59/0xc0
[  493.933180]  io_schedule+0x12/0x40 [  493.933285]
__lock_page+0x141/0x230 [  493.933391]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  493.933539]  f2fs_write_cache_pages+0x38a/0x840
[  493.933708]  ? do_writepages+0xd1/0x190 [  493.933821]  ?
do_writepages+0xd1/0x190 [  493.933939]
f2fs_write_data_pages+0x20e/0x3f0 [  493.935516]  ?
rcu_read_lock_held_common+0xe/0x40
[  493.935682]  ? do_writepages+0xd1/0x190 [  493.935790]
do_writepages+0xd1/0x190 [  493.935895]
file_write_and_wait_range+0xa3/0xe0
[  493.938074]  f2fs_do_sync_file+0x10f/0x910 [  493.938225]
do_fsync+0x38/0x60 [  493.938328]  __x64_sys_fsync+0x10/0x20 [
493.938430]  do_syscall_64+0x3a/0x90 [  493.938548]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  493.938683] RIP: 0033:0x7f64cb26ca97 [  493.938783] RSP:

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

Quoted 8 lines
Quoted 8 lines

000000000000004a [

Quoted 6 lines

493.938969] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 493.940413] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 493.940591] RBP:
00007f647e283a10 R08: 0000000000000000 R09: 00007ffe387e6170 [ 493.940759] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 493.940924] R13: 00007f647e2c80e8 R14:

0000000000000000 R15: 000056378a8ad568 [ 493.941341] INFO:

lockdep

Quoted 6 lines
Quoted 6 lines

is turned off.

Quoted 3 lines
[  616.796413] INFO: task fio:479 blocked for more than 245 seconds.
[  616.796706]       Not tainted 5.15.0-rc1+ #516
[  616.796824] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"

disables this message.

Quoted 1 line
[  616.827081] task:fio             state:D stack:13008 pid:  479

ppid:

Quoted 11 lines
Quoted 11 lines

474 flags:0x00004000

Quoted 10 lines
[  616.841373] Call Trace:
[  616.841492]  __schedule+0x317/0x920 [  616.841635]  ?
rcu_read_lock_sched_held+0x23/0x80
[  616.841767]  schedule+0x59/0xc0
[  616.841858]  io_schedule+0x12/0x40 [  616.841952]
__lock_page+0x141/0x230 [  616.852135]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  616.852305]  f2fs_write_multi_pages+0x1a7/0x9c0
[  616.852455]  f2fs_write_cache_pages+0x711/0x840
[  616.852661]  f2fs_write_data_pages+0x20e/0x3f0
[  616.852785]  ?
Quoted 17 lines
Quoted 17 lines
Quoted 10 lines
rcu_read_lock_held_common+0xe/0x40
[  616.852924]  ? do_writepages+0xd1/0x190 [  616.853281]
do_writepages+0xd1/0x190 [  616.853409]
file_write_and_wait_range+0xa3/0xe0
[  616.853537]  f2fs_do_sync_file+0x10f/0x910 [  616.853670]
do_fsync+0x38/0x60 [  616.853773]  __x64_sys_fsync+0x10/0x20 [
616.853869]  do_syscall_64+0x3a/0x90 [  616.853971]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  616.863145] RIP: 0033:0x7f64cb26ca97 [  616.863273] RSP:

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

000000000000004a [

Quoted 6 lines

616.863468] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 616.863635] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 616.863803] RBP:
00007f647e23f000 R08: 0000000000000000 R09: 00007ffe387e6170 [ 616.863975] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 616.870147] R13: 00007f647e2836d8 R14:

Quoted 6 lines
Quoted 6 lines

0000000000000000 R15: 000056378a8ad568 [ 616.870388] INFO: task fio:480 blocked for more than 245 seconds.

Quoted 2 lines
[  616.870537]       Not tainted 5.15.0-rc1+ #516
[  616.870650] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"

disables this message.

Quoted 1 line
[  616.870833] task:fio             state:D stack:13216 pid:  480

ppid:

Quoted 22 lines
Quoted 22 lines

474 flags:0x00000000

Quoted 21 lines
[  616.872161] Call Trace:
[  616.872257]  __schedule+0x317/0x920 [  616.872366]  ?
rcu_read_lock_sched_held+0x23/0x80
[  616.872503]  schedule+0x59/0xc0
[  616.872596]  io_schedule+0x12/0x40 [  616.872694]
__lock_page+0x141/0x230 [  616.872803]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  616.872945]  f2fs_write_cache_pages+0x38a/0x840
[  616.873331]  ? do_writepages+0xd1/0x190 [  616.873448]  ?
do_writepages+0xd1/0x190 [  616.873569]
f2fs_write_data_pages+0x20e/0x3f0 [  616.873694]  ?
rcu_read_lock_held_common+0xe/0x40
[  616.873833]  ? do_writepages+0xd1/0x190 [  616.873936]
do_writepages+0xd1/0x190 [  616.874272]
file_write_and_wait_range+0xa3/0xe0
[  616.874424]  f2fs_do_sync_file+0x10f/0x910 [  616.874560]
do_fsync+0x38/0x60 [  616.874660]  __x64_sys_fsync+0x10/0x20 [
616.874759]  do_syscall_64+0x3a/0x90 [  616.874863]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  616.875792] RIP: 0033:0x7f64cb26ca97 [  616.875905] RSP:

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

Quoted 8 lines
Quoted 8 lines

000000000000004a [

Quoted 6 lines

616.876345] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 616.876515] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 616.876692] RBP:
00007f647e283a10 R08: 0000000000000000 R09: 00007ffe387e6170 [ 616.876859] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 616.877231] R13: 00007f647e2c80e8 R14:

0000000000000000 R15: 000056378a8ad568 [ 616.877456] INFO:

lockdep

Quoted 35 lines
Quoted 35 lines

is turned off.

Quoted 34 lines
Quoted 34 lines

If there is, it needs to figure out the root cause.

Thanks,

Quoted 30 lines

fio.conf:
[global]
direct=1
numjobs=8
time_based
runtime=30
ioengine=sync
iodepth=16
buffer_pattern="ZZZZ"
fsync=1

[file0]
name=fio-rand-RW
filename=fio-rand-RW
rw=rw
rwmixread=60
rwmixwrite=40
bs=1M
size=64M

[file1]
name=fio-rand-RW
filename=fio-rand-RW
rw=randrw
rwmixread=60
rwmixwrite=40
bs=4K
size=64M

Quoted 1 line
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Thanks,

Quoted 2 lines

is ok. So I think maybe we should use another lock to allow write

different files in multithread.

Quoted 1 line

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

A message that is not in the archive (sent off-list or not yet received): AHYAMQC7E1oPQCsov290cqpf.9.1636946920105.Hmail.changfengnan@vivo.com

author
#23 lore raw
Quoted 98 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Chao Yu
Sent: Monday, November 15, 2021 11:29 AM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 4 lines · 常凤楠
Quoted 4 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf

Of Chao

Quoted 9 lines
Quoted 9 lines

Yu
Sent: Monday, November 15, 2021 10:47 AM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 2 lines · 常凤楠
Quoted 2 lines

-----Original Message-----
From: [email protected] <[email protected]> On

Behalf

Quoted 33 lines
Quoted 33 lines

Of Chao

Quoted 11 lines
Quoted 11 lines

Yu
Sent: Saturday, November 13, 2021 2:21 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 4 lines · 常凤楠
Quoted 4 lines

-----Original Message-----
From: [email protected] <[email protected]> On

Behalf

Quoted 20 lines
Quoted 20 lines

Of Chao

Quoted 11 lines
Quoted 11 lines

Yu
Sent: Tuesday, November 9, 2021 9:41 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 4 lines · 常凤楠
Quoted 4 lines

-----Original Message-----
From: [email protected] <[email protected]> On

Behalf

Quoted 7 lines
Quoted 7 lines

Of Chao

Quoted 6 lines
Quoted 6 lines

Yu
Sent: Monday, November 8, 2021 10:21 PM
To: 常凤楠 <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: Do we need serial io for compress file?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines · Fengnan Chang
Quoted 6 lines

In my test, serial io for compress file will make multithread small write performance drop a lot.

I'm try to fingure out why we need __should_serialize_io, IMO, we use __should_serialize_io to avoid deadlock or try to improve sequential performance, but I don't understand why

we

Quoted 20 lines
Quoted 20 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

should

do

Quoted 18 lines
Quoted 18 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

this for

It was introduced to avoid fragmentation of file blocks.

So, for small write on compress file, is this still necessary? I think we

Quoted 7 lines
Quoted 4 lines

should treat compress file as regular file.

Any real scenario there? let me know if I missed any cases, as I saw, most compressible files are not small...

Maybe my description is incorrect, small write means write with small

block size, for example 4K.

Quoted 2 lines

When write multi compress file with bs=4k in multithread, the serialize

io make performance drop a lot.

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Got it, but I mean what the real usercase is... rather than benchmark scenario.

I think it’s quite common user case if we take compress file as normal file to use,

Well, I mean what's the type of file that you want to compress, and which apps will use them? and what's the IO model runs on

compressed file?

Quoted 1 line

For now, I haven't test this on normal app, I test compress file on a test

app, it's try to simulate IO type of actual user case.

Quoted 8 lines
Quoted 1 line

This case is try to simulate multithread SQL performance and random

write, the test file is db and no extension name file.

Oh, IMO, SQLite is not target application scenario of f2fs compression functionality.

It may suffer performance regression due to write amplification during SQLite's random write.

Um, for now it's may not worthy enough , maybe it will become bottleneck in future, I still think fix this is necessary if we can avoid fragment at same time. Maybe we should discuss this later.

Thanks.

Quoted 188 lines

Thanks,

Quoted 67 lines
Quoted 67 lines

Thanks,

Quoted 2 lines

write multi file with bs < cluster size at same time will be bothered by

this issue.

Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines

compressed file. In my test, if we just remove this, write same file in multithread will have problem, but parallel write different files in multithread

What do you mean by "write same file in multithread will have

problem"?

Quoted 9 lines

If just remove compress file in __should_serialize_io()

fs/f2fs/data.c index renamed from fs/f2fs/data.c +0 -0

f4fd6c246c9a..7bd429b46429 100644

fs/f2fs/data.c +0 -0
@@ -3165,8 +3165,8 @@ static inline bool

__should_serialize_io(struct

inode *inode,

Quoted 12 lines
            if (IS_NOQUOTA(inode))
                    return false;
fs/f2fs/data.c +2 -2
-       if (f2fs_need_compress_data(inode))
-               return true;
+       //if (f2fs_need_compress_data(inode))
+       //      return true;
            if (wbc->sync_mode != WB_SYNC_ALL)
                    return true;
            if (get_dirty_pages(inode) >=

SM_I(F2FS_I_SB(inode))->min_seq_blocks)

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

and use fio to start multi thread to write same file, fio will hung.

Any potential hangtask issue there? did you get any stack backtrace

log?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line

Yes, it's quite easy to reproduce in my test.

What's your testcase? and filesystem configuration?

The test case as below fio conf. filesystem configure, the whole kernel

config as attached config.rar file.

Quoted 15 lines

CONFIG_F2FS_FS=y
CONFIG_F2FS_STAT_FS=y
CONFIG_F2FS_FS_XATTR=y
CONFIG_F2FS_FS_POSIX_ACL=y
CONFIG_F2FS_FS_SECURITY=y
CONFIG_F2FS_CHECK_FS=y
CONFIG_F2FS_FAULT_INJECTION=y
CONFIG_F2FS_FS_COMPRESSION=y
CONFIG_F2FS_FS_LZO=y
CONFIG_F2FS_FS_LZORLE=y
CONFIG_F2FS_FS_LZ4=y
CONFIG_F2FS_FS_LZ4HC=y
CONFIG_F2FS_FS_ZSTD=y
CONFIG_F2FS_IOSTAT=y

Quoted 1 line
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Thanks,

Quoted 2 lines
Backtrace:
[  493.915408] INFO: task fio:479 blocked for more than 122

seconds.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
[  493.915729]       Not tainted 5.15.0-rc1+ #516
[  493.915845] "echo 0 >

/proc/sys/kernel/hung_task_timeout_secs"

Quoted 25 lines
Quoted 25 lines
Quoted 2 lines
Quoted 2 lines

disables this message.

Quoted 1 line
[  493.916265] task:fio             state:D stack:13008 pid:  479

ppid:

Quoted 11 lines
Quoted 11 lines

474 flags:0x00004000

Quoted 10 lines
[  493.916686] Call Trace:
[  493.917310]  __schedule+0x317/0x920 [  493.917560]  ?
rcu_read_lock_sched_held+0x23/0x80
[  493.917705]  schedule+0x59/0xc0 [  493.917798]
io_schedule+0x12/0x40 [  493.917895]
__lock_page+0x141/0x230 [  493.924703]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  493.926404]  f2fs_write_multi_pages+0x1a7/0x9c0
[  493.926579]  f2fs_write_cache_pages+0x711/0x840
[  493.926771]  f2fs_write_data_pages+0x20e/0x3f0
[  493.926906]  ?
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
rcu_read_lock_held_common+0xe/0x40
[  493.928305]  ? do_writepages+0xd1/0x190 [  493.928439]
do_writepages+0xd1/0x190 [  493.928551]
file_write_and_wait_range+0xa3/0xe0
[  493.928690]  f2fs_do_sync_file+0x10f/0x910 [  493.928823]
do_fsync+0x38/0x60 [  493.928924]  __x64_sys_fsync+0x10/0x20 [
493.929208]  do_syscall_64+0x3a/0x90 [  493.929327]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  493.929486] RIP: 0033:0x7f64cb26ca97 [  493.929636] RSP:

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

000000000000004a [

Quoted 6 lines

493.929816] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 493.929975] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 493.931164] RBP:
00007f647e23f000 R08: 0000000000000000 R09: 00007ffe387e6170 [ 493.931347] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 493.931517] R13: 00007f647e2836d8 R14:

0000000000000000 R15: 000056378a8ad568 [ 493.931802] INFO:

task

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

fio:480 blocked for more than 122 seconds.

Quoted 2 lines
[  493.931946]       Not tainted 5.15.0-rc1+ #516
[  493.932202] "echo 0 >

/proc/sys/kernel/hung_task_timeout_secs"

Quoted 32 lines
Quoted 32 lines
Quoted 2 lines
Quoted 2 lines

disables this message.

Quoted 1 line
[  493.932382] task:fio             state:D stack:13216 pid:  480

ppid:

Quoted 29 lines
Quoted 29 lines

474 flags:0x00000000

Quoted 20 lines
[  493.932596] Call Trace:
[  493.932681]  __schedule+0x317/0x920 [  493.932796]  ?
rcu_read_lock_sched_held+0x23/0x80
[  493.932939]  schedule+0x59/0xc0 [  493.933180]
io_schedule+0x12/0x40 [  493.933285]
__lock_page+0x141/0x230 [  493.933391]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  493.933539]  f2fs_write_cache_pages+0x38a/0x840
[  493.933708]  ? do_writepages+0xd1/0x190 [  493.933821]  ?
do_writepages+0xd1/0x190 [  493.933939]
f2fs_write_data_pages+0x20e/0x3f0 [  493.935516]  ?
rcu_read_lock_held_common+0xe/0x40
[  493.935682]  ? do_writepages+0xd1/0x190 [  493.935790]
do_writepages+0xd1/0x190 [  493.935895]
file_write_and_wait_range+0xa3/0xe0
[  493.938074]  f2fs_do_sync_file+0x10f/0x910 [  493.938225]
do_fsync+0x38/0x60 [  493.938328]  __x64_sys_fsync+0x10/0x20 [
493.938430]  do_syscall_64+0x3a/0x90 [  493.938548]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  493.938683] RIP: 0033:0x7f64cb26ca97 [  493.938783] RSP:
Quoted 1 line

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

000000000000004a [

Quoted 6 lines

493.938969] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 493.940413] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 493.940591] RBP:
00007f647e283a10 R08: 0000000000000000 R09: 00007ffe387e6170 [ 493.940759] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 493.940924] R13: 00007f647e2c80e8 R14:

Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

0000000000000000 R15: 000056378a8ad568 [ 493.941341] INFO:

lockdep

Quoted 2 lines
Quoted 2 lines

is turned off.

Quoted 1 line
[  616.796413] INFO: task fio:479 blocked for more than 245

seconds.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
[  616.796706]       Not tainted 5.15.0-rc1+ #516
[  616.796824] "echo 0 >

/proc/sys/kernel/hung_task_timeout_secs"

Quoted 32 lines
Quoted 32 lines
Quoted 2 lines
Quoted 2 lines

disables this message.

Quoted 1 line
[  616.827081] task:fio             state:D stack:13008 pid:  479

ppid:

Quoted 11 lines
Quoted 11 lines

474 flags:0x00004000

Quoted 10 lines
[  616.841373] Call Trace:
[  616.841492]  __schedule+0x317/0x920 [  616.841635]  ?
rcu_read_lock_sched_held+0x23/0x80
[  616.841767]  schedule+0x59/0xc0 [  616.841858]
io_schedule+0x12/0x40 [  616.841952]
__lock_page+0x141/0x230 [  616.852135]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  616.852305]  f2fs_write_multi_pages+0x1a7/0x9c0
[  616.852455]  f2fs_write_cache_pages+0x711/0x840
[  616.852661]  f2fs_write_data_pages+0x20e/0x3f0
[  616.852785]  ?
Quoted 17 lines
Quoted 17 lines
Quoted 10 lines
rcu_read_lock_held_common+0xe/0x40
[  616.852924]  ? do_writepages+0xd1/0x190 [  616.853281]
do_writepages+0xd1/0x190 [  616.853409]
file_write_and_wait_range+0xa3/0xe0
[  616.853537]  f2fs_do_sync_file+0x10f/0x910 [  616.853670]
do_fsync+0x38/0x60 [  616.853773]  __x64_sys_fsync+0x10/0x20 [
616.853869]  do_syscall_64+0x3a/0x90 [  616.853971]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  616.863145] RIP: 0033:0x7f64cb26ca97 [  616.863273] RSP:

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

000000000000004a [

Quoted 6 lines

616.863468] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 616.863635] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 616.863803] RBP:
00007f647e23f000 R08: 0000000000000000 R09: 00007ffe387e6170 [ 616.863975] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 616.870147] R13: 00007f647e2836d8 R14:

Quoted 81 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

0000000000000000 R15: 000056378a8ad568 [ 616.870388] INFO:

task

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

fio:480 blocked for more than 245 seconds.

Quoted 2 lines
[  616.870537]       Not tainted 5.15.0-rc1+ #516
[  616.870650] "echo 0 >

/proc/sys/kernel/hung_task_timeout_secs"

Quoted 75 lines
Quoted 75 lines
Quoted 2 lines
Quoted 2 lines

disables this message.

Quoted 1 line
[  616.870833] task:fio             state:D stack:13216 pid:  480

ppid:

Quoted 22 lines
Quoted 22 lines

474 flags:0x00000000

Quoted 21 lines
[  616.872161] Call Trace:
[  616.872257]  __schedule+0x317/0x920 [  616.872366]  ?
rcu_read_lock_sched_held+0x23/0x80
[  616.872503]  schedule+0x59/0xc0 [  616.872596]
io_schedule+0x12/0x40 [  616.872694]
__lock_page+0x141/0x230 [  616.872803]  ?
filemap_invalidate_unlock_two+0x40/0x40
[  616.872945]  f2fs_write_cache_pages+0x38a/0x840
[  616.873331]  ? do_writepages+0xd1/0x190 [  616.873448]  ?
do_writepages+0xd1/0x190 [  616.873569]
f2fs_write_data_pages+0x20e/0x3f0 [  616.873694]  ?
rcu_read_lock_held_common+0xe/0x40
[  616.873833]  ? do_writepages+0xd1/0x190 [  616.873936]
do_writepages+0xd1/0x190 [  616.874272]
file_write_and_wait_range+0xa3/0xe0
[  616.874424]  f2fs_do_sync_file+0x10f/0x910 [  616.874560]
do_fsync+0x38/0x60 [  616.874660]  __x64_sys_fsync+0x10/0x20 [
616.874759]  do_syscall_64+0x3a/0x90 [  616.874863]
entry_SYSCALL_64_after_hwframe+0x44/0xae
[  616.875792] RIP: 0033:0x7f64cb26ca97 [  616.875905] RSP:

002b:00007ffe3863d180 EFLAGS: 00000293 ORIG_RAX:

Quoted 8 lines
Quoted 8 lines

000000000000004a [

Quoted 6 lines

616.876345] RAX: ffffffffffffffda RBX: 0000000000000005 RCX:
00007f64cb26ca97 [ 616.876515] RDX: 0000000000000000 RSI:
000056378a8ad540 RDI: 0000000000000005 [ 616.876692] RBP:
00007f647e283a10 R08: 0000000000000000 R09: 00007ffe387e6170 [ 616.876859] R10: 00007ffe387e61b0 R11: 0000000000000293 R12:
0000000000000003 [ 616.877231] R13: 00007f647e2c80e8 R14:

0000000000000000 R15: 000056378a8ad568 [ 616.877456] INFO:

lockdep

Quoted 41 lines
Quoted 41 lines

is turned off.

Quoted 40 lines
Quoted 40 lines

If there is, it needs to figure out the root cause.

Thanks,

Quoted 36 lines

fio.conf:
[global]
direct=1
numjobs=8
time_based
runtime=30
ioengine=sync
iodepth=16
buffer_pattern="ZZZZ"
fsync=1

[file0]
name=fio-rand-RW
filename=fio-rand-RW
rw=rw
rwmixread=60
rwmixwrite=40
bs=1M
size=64M

[file1]
name=fio-rand-RW
filename=fio-rand-RW
rw=randrw
rwmixread=60
rwmixwrite=40
bs=4K
size=64M

Quoted 7 lines

Thanks,

Quoted 2 lines

is ok. So I think maybe we should use another lock to allow write

different files in multithread.

Quoted 1 line

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel