Skip to contentSkip to conversation

f2fs: change virtual mapping way for compression pages

PATCH Superseded Daeho Jeong 3 participants 10 messages Aug 11, 2020 – Aug 12, 2020 F2FS file system

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: change virtual mapping way for compression pages

From: Daeho Jeong <[email protected]>

By profiling f2fs compression works, I've found vmap() callings are bottlenecks of f2fs decompression path. Changing these with vm_map_ram(), we can enhance f2fs decompression speed pretty much.

[Verification]
dd if=/dev/zero of=dummy bs=1m count=1000
echo 3 > /proc/sys/vm/drop_caches
dd if=dummy of=/dev/zero bs=512k

- w/o compression -
1048576000 bytes (0.9 G) copied, 1.999384 s, 500 M/s 1048576000 bytes (0.9 G) copied, 2.035988 s, 491 M/s 1048576000 bytes (0.9 G) copied, 2.039457 s, 490 M/s

- before patch -
1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

- after patch -
1048576000 bytes (0.9 G) copied, 2.253441 s, 444 M/s 1048576000 bytes (0.9 G) copied, 2.739764 s, 365 M/s 1048576000 bytes (0.9 G) copied, 2.185649 s, 458 M/s

---
 fs/f2fs/compress.c | 42 ++++++++++++++++++++++++++++++++----------
 1 file changed, 32 insertions(+), 10 deletions(-)
fs/f2fs/compress.c +32 -10
index 6e7db450006c..46b7e359f313 100644
@@ -554,6 +554,8 @@ static void f2fs_compress_free_page(struct page *page)
 	mempool_free(page, compress_page_pool);
 }
 
+#define MAX_VMAP_RETRIES	3
+
 static int f2fs_compress_pages(struct compress_ctx *cc)
 {
 	struct f2fs_sb_info *sbi = F2FS_I_SB(cc->inode);
@@ -590,13 +592,23 @@ static int f2fs_compress_pages(struct compress_ctx *cc)
 		}
 	}
 
-	cc->rbuf = vmap(cc->rpages, cc->cluster_size, VM_MAP, PAGE_KERNEL_RO);
+	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
+		cc->rbuf = vm_map_ram(cc->rpages, cc->cluster_size, -1);
+		if (cc->rbuf)
+			break;
+		vm_unmap_aliases();
+	}
 	if (!cc->rbuf) {
 		ret = -ENOMEM;
 		goto out_free_cpages;
 	}
 
-	cc->cbuf = vmap(cc->cpages, cc->nr_cpages, VM_MAP, PAGE_KERNEL);
+	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
+		cc->cbuf = vm_map_ram(cc->cpages, cc->nr_cpages, -1);
+		if (cc->cbuf)
+			break;
+		vm_unmap_aliases();
+	}
 	if (!cc->cbuf) {
 		ret = -ENOMEM;
 		goto out_vunmap_rbuf;
@@ -624,8 +636,8 @@ static int f2fs_compress_pages(struct compress_ctx *cc)
 	memset(&cc->cbuf->cdata[cc->clen], 0,
 	       (nr_cpages * PAGE_SIZE) - (cc->clen + COMPRESS_HEADER_SIZE));
 
-	vunmap(cc->cbuf);
-	vunmap(cc->rbuf);
+	vm_unmap_ram(cc->cbuf, cc->nr_cpages);
+	vm_unmap_ram(cc->rbuf, cc->cluster_size);
 
 	for (i = nr_cpages; i < cc->nr_cpages; i++) {
 		f2fs_compress_free_page(cc->cpages[i]);
@@ -642,9 +654,9 @@ static int f2fs_compress_pages(struct compress_ctx *cc)
 	return 0;
 
 out_vunmap_cbuf:
-	vunmap(cc->cbuf);
+	vm_unmap_ram(cc->cbuf, cc->nr_cpages);
 out_vunmap_rbuf:
-	vunmap(cc->rbuf);
+	vm_unmap_ram(cc->rbuf, cc->cluster_size);
 out_free_cpages:
 	for (i = 0; i < cc->nr_cpages; i++) {
 		if (cc->cpages[i])
@@ -715,13 +727,23 @@ void f2fs_decompress_pages(struct bio *bio, struct page *page, bool verity)
 			goto out_free_dic;
 	}
 
-	dic->rbuf = vmap(dic->tpages, dic->cluster_size, VM_MAP, PAGE_KERNEL);
+	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
+		dic->rbuf = vm_map_ram(dic->tpages, dic->cluster_size, -1);
+		if (dic->rbuf)
+			break;
+		vm_unmap_aliases();
+	}
 	if (!dic->rbuf) {
 		ret = -ENOMEM;
 		goto destroy_decompress_ctx;
 	}
 
-	dic->cbuf = vmap(dic->cpages, dic->nr_cpages, VM_MAP, PAGE_KERNEL_RO);
+	for (i = 0; i < MAX_VMAP_RETRIES; i++) {
+		dic->cbuf = vm_map_ram(dic->cpages, dic->nr_cpages, -1);
+		if (dic->cbuf)
+			break;
+		vm_unmap_aliases();
+	}
 	if (!dic->cbuf) {
 		ret = -ENOMEM;
 		goto out_vunmap_rbuf;
@@ -738,9 +760,9 @@ void f2fs_decompress_pages(struct bio *bio, struct page *page, bool verity)
 	ret = cops->decompress_pages(dic);
 
 out_vunmap_cbuf:
-	vunmap(dic->cbuf);
+	vm_unmap_ram(dic->cbuf, dic->nr_cpages);
 out_vunmap_rbuf:
-	vunmap(dic->rbuf);
+	vm_unmap_ram(dic->rbuf, dic->cluster_size);
 destroy_decompress_ctx:
 	if (cops->destroy_decompress_ctx)
 		cops->destroy_decompress_ctx(dic);
Signature · 1 line
2.28.0.236.gb10cc79966-goog
#1 lore raw
Quoted 21 lines · Daeho Jeong

From: Daeho Jeong <[email protected]>

By profiling f2fs compression works, I've found vmap() callings are bottlenecks of f2fs decompression path. Changing these with vm_map_ram(), we can enhance f2fs decompression speed pretty much.

[Verification]
dd if=/dev/zero of=dummy bs=1m count=1000
echo 3 > /proc/sys/vm/drop_caches
dd if=dummy of=/dev/zero bs=512k

- w/o compression -
1048576000 bytes (0.9 G) copied, 1.999384 s, 500 M/s 1048576000 bytes (0.9 G) copied, 2.035988 s, 491 M/s 1048576000 bytes (0.9 G) copied, 2.039457 s, 490 M/s

- before patch -
1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

Quoted 4 lines

- after patch -
1048576000 bytes (0.9 G) copied, 2.253441 s, 444 M/s 1048576000 bytes (0.9 G) copied, 2.739764 s, 365 M/s 1048576000 bytes (0.9 G) copied, 2.185649 s, 458 M/s

Indeed, vmap() approach has some impact on the whole workflow. But I don't think the gap is such significant, maybe it relates to unlocked cpufreq (and big little core difference if it's on some arm64 board).

#2 lore raw
Quoted 27 lines · Gao Xiang
Quoted 21 lines · Daeho Jeong

From: Daeho Jeong <[email protected]>

By profiling f2fs compression works, I've found vmap() callings are bottlenecks of f2fs decompression path. Changing these with vm_map_ram(), we can enhance f2fs decompression speed pretty much.

[Verification]
dd if=/dev/zero of=dummy bs=1m count=1000
echo 3 > /proc/sys/vm/drop_caches
dd if=dummy of=/dev/zero bs=512k

- w/o compression -
1048576000 bytes (0.9 G) copied, 1.999384 s, 500 M/s 1048576000 bytes (0.9 G) copied, 2.035988 s, 491 M/s 1048576000 bytes (0.9 G) copied, 2.039457 s, 490 M/s

- before patch -
1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

Quoted 4 lines

- after patch -
1048576000 bytes (0.9 G) copied, 2.253441 s, 444 M/s 1048576000 bytes (0.9 G) copied, 2.739764 s, 365 M/s 1048576000 bytes (0.9 G) copied, 2.185649 s, 458 M/s

Quoted 4 lines

Indeed, vmap() approach has some impact on the whole workflow. But I don't think the gap is such significant, maybe it relates to unlocked cpufreq (and big little core difference if it's on some arm64 board).

Agreed,

I guess there should be other reason causing the large performance gap, scheduling, frequency, or something else.

Quoted 9 lines

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

#3 lore raw

Actually, as you can see, I use the whole zero data blocks in the test file. It can maximize the effect of changing virtual mapping.
When I use normal files which can be compressed about 70% from the original file,
The vm_map_ram() version is about 2x faster than vmap() version.

2020년 8월 11일 (화) 오후 4:55, Chao Yu <[email protected]>님이 작성:

Quoted 48 lines · Gao Xiang
Quoted 27 lines · Daeho Jeong
Quoted 21 lines

From: Daeho Jeong <[email protected]>

By profiling f2fs compression works, I've found vmap() callings are bottlenecks of f2fs decompression path. Changing these with vm_map_ram(), we can enhance f2fs decompression speed pretty much.

[Verification]
dd if=/dev/zero of=dummy bs=1m count=1000
echo 3 > /proc/sys/vm/drop_caches
dd if=dummy of=/dev/zero bs=512k

- w/o compression -
1048576000 bytes (0.9 G) copied, 1.999384 s, 500 M/s 1048576000 bytes (0.9 G) copied, 2.035988 s, 491 M/s 1048576000 bytes (0.9 G) copied, 2.039457 s, 490 M/s

- before patch -
1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

Quoted 4 lines

- after patch -
1048576000 bytes (0.9 G) copied, 2.253441 s, 444 M/s 1048576000 bytes (0.9 G) copied, 2.739764 s, 365 M/s 1048576000 bytes (0.9 G) copied, 2.185649 s, 458 M/s

Quoted 4 lines

Indeed, vmap() approach has some impact on the whole workflow. But I don't think the gap is such significant, maybe it relates to unlocked cpufreq (and big little core difference if it's on some arm64 board).

Agreed,

I guess there should be other reason causing the large performance gap, scheduling, frequency, or something else.

Quoted 9 lines

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

#4 lore raw

Plus, when we use vmap(), vmap() normally executes in a short time like vm_map_ram().
But, sometimes, it has a very long delay.

2020년 8월 11일 (화) 오후 6:28, Daeho Jeong <[email protected]>님이 작성:

Quoted 56 lines

Actually, as you can see, I use the whole zero data blocks in the test file. It can maximize the effect of changing virtual mapping.
When I use normal files which can be compressed about 70% from the original file,
The vm_map_ram() version is about 2x faster than vmap() version.

2020년 8월 11일 (화) 오후 4:55, Chao Yu <[email protected]>님이 작성:

Quoted 48 lines · Gao Xiang
Quoted 27 lines · Daeho Jeong
Quoted 21 lines

From: Daeho Jeong <[email protected]>

By profiling f2fs compression works, I've found vmap() callings are bottlenecks of f2fs decompression path. Changing these with vm_map_ram(), we can enhance f2fs decompression speed pretty much.

[Verification]
dd if=/dev/zero of=dummy bs=1m count=1000
echo 3 > /proc/sys/vm/drop_caches
dd if=dummy of=/dev/zero bs=512k

- w/o compression -
1048576000 bytes (0.9 G) copied, 1.999384 s, 500 M/s 1048576000 bytes (0.9 G) copied, 2.035988 s, 491 M/s 1048576000 bytes (0.9 G) copied, 2.039457 s, 490 M/s

- before patch -
1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

Quoted 4 lines

- after patch -
1048576000 bytes (0.9 G) copied, 2.253441 s, 444 M/s 1048576000 bytes (0.9 G) copied, 2.739764 s, 365 M/s 1048576000 bytes (0.9 G) copied, 2.185649 s, 458 M/s

Quoted 4 lines

Indeed, vmap() approach has some impact on the whole workflow. But I don't think the gap is such significant, maybe it relates to unlocked cpufreq (and big little core difference if it's on some arm64 board).

Agreed,

I guess there should be other reason causing the large performance gap, scheduling, frequency, or something else.

Quoted 9 lines

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

#5 lore raw
Quoted 11 lines · Daeho Jeong

Plus, when we use vmap(), vmap() normally executes in a short time like vm_map_ram().
But, sometimes, it has a very long delay.

2020년 8월 11일 (화) 오후 6:28, Daeho Jeong <[email protected]>님이 작성:

Quoted 6 lines

Actually, as you can see, I use the whole zero data blocks in the test file. It can maximize the effect of changing virtual mapping.
When I use normal files which can be compressed about 70% from the original file,
The vm_map_ram() version is about 2x faster than vmap() version.

What f2fs does is much similar to btrfs compression. Even if these blocks are all zeroed. In principle, the maximum compression ratio is determined (cluster sized blocks into one compressed block, e.g 16k cluster into one compressed block).

So it'd be better to describe your configured cluster size (16k or 128k) and your hardware information in the commit message as well.

Actually, I also tried with this patch as well on my x86 laptop just now with FIO (I didn't use zeroed block though), and I didn't notice much difference with turbo boost off and maxfreq.

I'm not arguing this commit, just a note about this commit message.

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

1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

IMHO, the above number is much like decompressing in the arm64 little cores.

Thanks,
Gao Xiang

Quoted 51 lines
Quoted 50 lines

2020년 8월 11일 (화) 오후 4:55, Chao Yu <[email protected]>님이 작성:

Quoted 48 lines · Gao Xiang
Quoted 27 lines · Daeho Jeong
Quoted 21 lines

From: Daeho Jeong <[email protected]>

By profiling f2fs compression works, I've found vmap() callings are bottlenecks of f2fs decompression path. Changing these with vm_map_ram(), we can enhance f2fs decompression speed pretty much.

[Verification]
dd if=/dev/zero of=dummy bs=1m count=1000
echo 3 > /proc/sys/vm/drop_caches
dd if=dummy of=/dev/zero bs=512k

- w/o compression -
1048576000 bytes (0.9 G) copied, 1.999384 s, 500 M/s 1048576000 bytes (0.9 G) copied, 2.035988 s, 491 M/s 1048576000 bytes (0.9 G) copied, 2.039457 s, 490 M/s

- before patch -
1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

Quoted 4 lines

- after patch -
1048576000 bytes (0.9 G) copied, 2.253441 s, 444 M/s 1048576000 bytes (0.9 G) copied, 2.739764 s, 365 M/s 1048576000 bytes (0.9 G) copied, 2.185649 s, 458 M/s

Quoted 4 lines

Indeed, vmap() approach has some impact on the whole workflow. But I don't think the gap is such significant, maybe it relates to unlocked cpufreq (and big little core difference if it's on some arm64 board).

Agreed,

I guess there should be other reason causing the large performance gap, scheduling, frequency, or something else.

Quoted 9 lines

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

#6 lore raw

Sure, I'll update the test condition as you said in the commit message. FYI, the test is done with 16kb chunk and Pixel 3 (arm64) device.

Thanks,

2020년 8월 11일 (화) 오후 7:18, Gao Xiang <[email protected]>님이 작성:

Quoted 89 lines · Daeho Jeong
Quoted 11 lines

Plus, when we use vmap(), vmap() normally executes in a short time like vm_map_ram().
But, sometimes, it has a very long delay.

2020ë…„ 8ì›” 11ì�¼ (í™”) 오후 6:28, Daeho Jeong <[email protected]>님ì�´ 작성:

Quoted 6 lines

Actually, as you can see, I use the whole zero data blocks in the test file. It can maximize the effect of changing virtual mapping.
When I use normal files which can be compressed about 70% from the original file,
The vm_map_ram() version is about 2x faster than vmap() version.

What f2fs does is much similar to btrfs compression. Even if these blocks are all zeroed. In principle, the maximum compression ratio is determined (cluster sized blocks into one compressed block, e.g 16k cluster into one compressed block).

So it'd be better to describe your configured cluster size (16k or 128k) and your hardware information in the commit message as well.

Actually, I also tried with this patch as well on my x86 laptop just now with FIO (I didn't use zeroed block though), and I didn't notice much difference with turbo boost off and maxfreq.

I'm not arguing this commit, just a note about this commit message.

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

1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

IMHO, the above number is much like decompressing in the arm64 little cores.

Thanks,
Gao Xiang

Quoted 51 lines
Quoted 50 lines

2020ë…„ 8ì›” 11ì�¼ (í™”) 오후 4:55, Chao Yu <[email protected]>님ì�´ 작성:

Quoted 48 lines · Gao Xiang
Quoted 27 lines · Daeho Jeong
Quoted 21 lines

From: Daeho Jeong <[email protected]>

By profiling f2fs compression works, I've found vmap() callings are bottlenecks of f2fs decompression path. Changing these with vm_map_ram(), we can enhance f2fs decompression speed pretty much.

[Verification]
dd if=/dev/zero of=dummy bs=1m count=1000
echo 3 > /proc/sys/vm/drop_caches
dd if=dummy of=/dev/zero bs=512k

- w/o compression -
1048576000 bytes (0.9 G) copied, 1.999384 s, 500 M/s 1048576000 bytes (0.9 G) copied, 2.035988 s, 491 M/s 1048576000 bytes (0.9 G) copied, 2.039457 s, 490 M/s

- before patch -
1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

Quoted 4 lines

- after patch -
1048576000 bytes (0.9 G) copied, 2.253441 s, 444 M/s 1048576000 bytes (0.9 G) copied, 2.739764 s, 365 M/s 1048576000 bytes (0.9 G) copied, 2.185649 s, 458 M/s

Quoted 4 lines

Indeed, vmap() approach has some impact on the whole workflow. But I don't think the gap is such significant, maybe it relates to unlocked cpufreq (and big little core difference if it's on some arm64 board).

Agreed,

I guess there should be other reason causing the large performance gap, scheduling, frequency, or something else.

Quoted 9 lines

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

#7 lore raw
Quoted 2 lines · Daeho Jeong

Sure, I'll update the test condition as you said in the commit message. FYI, the test is done with 16kb chunk and Pixel 3 (arm64) device.

Yeah, anyway, it'd better to lock the freq and offline the little cores in your test as well (it'd make more sense). e.g. if 16k cluster is applied, even all data is zeroed, the count of vmap/vm_map_ram isn't hugeous (and as you said, "sometimes, it has a very long delay", it's much like another scheduling concern as well).

Anyway, I'm not against your commit but the commit message is a bit of unclear. At least, if you think that is really the case, I'm ok with that.

Thanks,
Gao Xiang

Quoted 94 lines

Thanks,

2020년 8월 11일 (화) 오후 7:18, Gao Xiang <[email protected]>님이 작성:

Quoted 89 lines · Daeho Jeong
Quoted 11 lines

Plus, when we use vmap(), vmap() normally executes in a short time like vm_map_ram().
But, sometimes, it has a very long delay.

2020ë…„ 8ì›” 11ì�¼ (í™”) 오후 6:28, Daeho Jeong <[email protected]>님ì�´ 작성:

Quoted 6 lines

Actually, as you can see, I use the whole zero data blocks in the test file. It can maximize the effect of changing virtual mapping.
When I use normal files which can be compressed about 70% from the original file,
The vm_map_ram() version is about 2x faster than vmap() version.

What f2fs does is much similar to btrfs compression. Even if these blocks are all zeroed. In principle, the maximum compression ratio is determined (cluster sized blocks into one compressed block, e.g 16k cluster into one compressed block).

So it'd be better to describe your configured cluster size (16k or 128k) and your hardware information in the commit message as well.

Actually, I also tried with this patch as well on my x86 laptop just now with FIO (I didn't use zeroed block though), and I didn't notice much difference with turbo boost off and maxfreq.

I'm not arguing this commit, just a note about this commit message.

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

1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

IMHO, the above number is much like decompressing in the arm64 little cores.

Thanks,
Gao Xiang

Quoted 51 lines
Quoted 50 lines

2020ë…„ 8ì›” 11ì�¼ (í™”) 오후 4:55, Chao Yu <[email protected]>님ì�´ 작성:

Quoted 48 lines · Gao Xiang
Quoted 27 lines · Daeho Jeong
Quoted 21 lines

From: Daeho Jeong <[email protected]>

By profiling f2fs compression works, I've found vmap() callings are bottlenecks of f2fs decompression path. Changing these with vm_map_ram(), we can enhance f2fs decompression speed pretty much.

[Verification]
dd if=/dev/zero of=dummy bs=1m count=1000
echo 3 > /proc/sys/vm/drop_caches
dd if=dummy of=/dev/zero bs=512k

- w/o compression -
1048576000 bytes (0.9 G) copied, 1.999384 s, 500 M/s 1048576000 bytes (0.9 G) copied, 2.035988 s, 491 M/s 1048576000 bytes (0.9 G) copied, 2.039457 s, 490 M/s

- before patch -
1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

Quoted 4 lines

- after patch -
1048576000 bytes (0.9 G) copied, 2.253441 s, 444 M/s 1048576000 bytes (0.9 G) copied, 2.739764 s, 365 M/s 1048576000 bytes (0.9 G) copied, 2.185649 s, 458 M/s

Quoted 4 lines

Indeed, vmap() approach has some impact on the whole workflow. But I don't think the gap is such significant, maybe it relates to unlocked cpufreq (and big little core difference if it's on some arm64 board).

Agreed,

I guess there should be other reason causing the large performance gap, scheduling, frequency, or something else.

Quoted 9 lines

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

#8 lore raw

Plus, differently from your testbed, in my pixel device, there seems to be much more contention in vmap() operation.
If it's not there, I agree that there might not be a big difference between vmap() and vm_map_ram().

2020년 8월 11일 (화) 오후 8:29, Gao Xiang <[email protected]>님이 작성:

Quoted 113 lines · Daeho Jeong
Quoted 2 lines

Sure, I'll update the test condition as you said in the commit message. FYI, the test is done with 16kb chunk and Pixel 3 (arm64) device.

Yeah, anyway, it'd better to lock the freq and offline the little cores in your test as well (it'd make more sense). e.g. if 16k cluster is applied, even all data is zeroed, the count of vmap/vm_map_ram isn't hugeous (and as you said, "sometimes, it has a very long delay", it's much like another scheduling concern as well).

Anyway, I'm not against your commit but the commit message is a bit of unclear. At least, if you think that is really the case, I'm ok with that.

Thanks,
Gao Xiang

Quoted 94 lines

Thanks,

2020ë…„ 8ì›” 11ì�¼ (í™”) 오후 7:18, Gao Xiang <[email protected]>님ì�´ 작성:

Quoted 89 lines · Daeho Jeong
Quoted 11 lines

Plus, when we use vmap(), vmap() normally executes in a short time like vm_map_ram().
But, sometimes, it has a very long delay.

2020ë…„ 8ì›â€� 11� (í™â€�) 오후 6:28, Daeho Jeong <[email protected]>님� 작성:

Quoted 6 lines

Actually, as you can see, I use the whole zero data blocks in the test file. It can maximize the effect of changing virtual mapping.
When I use normal files which can be compressed about 70% from the original file,
The vm_map_ram() version is about 2x faster than vmap() version.

What f2fs does is much similar to btrfs compression. Even if these blocks are all zeroed. In principle, the maximum compression ratio is determined (cluster sized blocks into one compressed block, e.g 16k cluster into one compressed block).

So it'd be better to describe your configured cluster size (16k or 128k) and your hardware information in the commit message as well.

Actually, I also tried with this patch as well on my x86 laptop just now with FIO (I didn't use zeroed block though), and I didn't notice much difference with turbo boost off and maxfreq.

I'm not arguing this commit, just a note about this commit message.

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

1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

IMHO, the above number is much like decompressing in the arm64 little cores.

Thanks,
Gao Xiang

Quoted 51 lines
Quoted 50 lines

2020ë…„ 8ì›â€� 11� (í™â€�) 오후 4:55, Chao Yu <[email protected]>님� 작성:

Quoted 48 lines · Gao Xiang
Quoted 27 lines · Daeho Jeong
Quoted 21 lines

From: Daeho Jeong <[email protected]>

By profiling f2fs compression works, I've found vmap() callings are bottlenecks of f2fs decompression path. Changing these with vm_map_ram(), we can enhance f2fs decompression speed pretty much.

[Verification]
dd if=/dev/zero of=dummy bs=1m count=1000
echo 3 > /proc/sys/vm/drop_caches
dd if=dummy of=/dev/zero bs=512k

- w/o compression -
1048576000 bytes (0.9 G) copied, 1.999384 s, 500 M/s 1048576000 bytes (0.9 G) copied, 2.035988 s, 491 M/s 1048576000 bytes (0.9 G) copied, 2.039457 s, 490 M/s

- before patch -
1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

Quoted 4 lines

- after patch -
1048576000 bytes (0.9 G) copied, 2.253441 s, 444 M/s 1048576000 bytes (0.9 G) copied, 2.739764 s, 365 M/s 1048576000 bytes (0.9 G) copied, 2.185649 s, 458 M/s

Quoted 4 lines

Indeed, vmap() approach has some impact on the whole workflow. But I don't think the gap is such significant, maybe it relates to unlocked cpufreq (and big little core difference if it's on some arm64 board).

Agreed,

I guess there should be other reason causing the large performance gap, scheduling, frequency, or something else.

Quoted 9 lines

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

#9 lore raw
Quoted 5 lines · Daeho Jeong

Plus, differently from your testbed, in my pixel device, there seems to be much more contention in vmap() operation.
If it's not there, I agree that there might not be a big difference between vmap() and vm_map_ram().

Quoted 8 lines

2020년 8월 11일 (화) 오후 8:29, Gao Xiang <[email protected]>님이 작성:

Quoted 7 lines · Daeho Jeong
Quoted 2 lines

Sure, I'll update the test condition as you said in the commit message. FYI, the test is done with 16kb chunk and Pixel 3 (arm64) device.

Yeah, anyway, it'd better to lock the freq and offline the little cores in your test as well (it'd make more sense). e.g. if 16k cluster

I'm not against this commit, but could you please try to adjust cpufreq to fixed value and offline little or big core, so that we can supply fair test environment during test, I just wonder that in such environment, how much we can improve the performance with vm_map_ram().

Quoted 108 lines
Quoted 4 lines

is applied, even all data is zeroed, the count of vmap/vm_map_ram isn't hugeous (and as you said, "sometimes, it has a very long delay", it's much like another scheduling concern as well).

Quoted 102 lines

Anyway, I'm not against your commit but the commit message is a bit of unclear. At least, if you think that is really the case, I'm ok with that.

Thanks,
Gao Xiang

Quoted 94 lines

Thanks,

2020ë…„ 8ì›” 11ì�¼ (í™”) 오후 7:18, Gao Xiang <[email protected]>님ì�´ 작성:

Quoted 89 lines · Daeho Jeong
Quoted 11 lines

Plus, when we use vmap(), vmap() normally executes in a short time like vm_map_ram().
But, sometimes, it has a very long delay.

2020ë…„ 8ì›â€� 11� (í™â€�) 오후 6:28, Daeho Jeong <[email protected]>님� 작성:

Quoted 6 lines

Actually, as you can see, I use the whole zero data blocks in the test file. It can maximize the effect of changing virtual mapping.
When I use normal files which can be compressed about 70% from the original file,
The vm_map_ram() version is about 2x faster than vmap() version.

What f2fs does is much similar to btrfs compression. Even if these blocks are all zeroed. In principle, the maximum compression ratio is determined (cluster sized blocks into one compressed block, e.g 16k cluster into one compressed block).

So it'd be better to describe your configured cluster size (16k or 128k) and your hardware information in the commit message as well.

Actually, I also tried with this patch as well on my x86 laptop just now with FIO (I didn't use zeroed block though), and I didn't notice much difference with turbo boost off and maxfreq.

I'm not arguing this commit, just a note about this commit message.

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

1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

IMHO, the above number is much like decompressing in the arm64 little cores.

Thanks,
Gao Xiang

Quoted 51 lines
Quoted 50 lines

2020ë…„ 8ì›â€� 11� (í™â€�) 오후 4:55, Chao Yu <[email protected]>님� 작성:

Quoted 48 lines · Gao Xiang
Quoted 27 lines · Daeho Jeong
Quoted 21 lines

From: Daeho Jeong <[email protected]>

By profiling f2fs compression works, I've found vmap() callings are bottlenecks of f2fs decompression path. Changing these with vm_map_ram(), we can enhance f2fs decompression speed pretty much.

[Verification]
dd if=/dev/zero of=dummy bs=1m count=1000
echo 3 > /proc/sys/vm/drop_caches
dd if=dummy of=/dev/zero bs=512k

- w/o compression -
1048576000 bytes (0.9 G) copied, 1.999384 s, 500 M/s 1048576000 bytes (0.9 G) copied, 2.035988 s, 491 M/s 1048576000 bytes (0.9 G) copied, 2.039457 s, 490 M/s

- before patch -
1048576000 bytes (0.9 G) copied, 9.146217 s, 109 M/s 1048576000 bytes (0.9 G) copied, 9.997542 s, 100 M/s 1048576000 bytes (0.9 G) copied, 10.109727 s, 99 M/s

Quoted 4 lines

- after patch -
1048576000 bytes (0.9 G) copied, 2.253441 s, 444 M/s 1048576000 bytes (0.9 G) copied, 2.739764 s, 365 M/s 1048576000 bytes (0.9 G) copied, 2.185649 s, 458 M/s

Quoted 4 lines

Indeed, vmap() approach has some impact on the whole workflow. But I don't think the gap is such significant, maybe it relates to unlocked cpufreq (and big little core difference if it's on some arm64 board).

Agreed,

I guess there should be other reason causing the large performance gap, scheduling, frequency, or something else.

Quoted 9 lines

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

.