From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: linux-erofs@lists.ozlabs.org, Chao Yu <chao@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Gao Xiang <hsiangkao@linux.alibaba.com>
Subject: [PATCH v2 11/16] erofs: get rid of `z_pagemap_global'
Date: Fri, 15 Jul 2022 23:41:58 +0800 [thread overview]
Message-ID: <20220715154203.48093-12-hsiangkao@linux.alibaba.com> (raw)
In-Reply-To: <20220715154203.48093-1-hsiangkao@linux.alibaba.com>
In order to introduce multi-reference pclusters for compressed data
deduplication, let's get rid of the global page array for now since
it needs to be re-designed then at least.
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
fs/erofs/zdata.c | 28 ++++------------------------
fs/erofs/zdata.h | 1 -
2 files changed, 4 insertions(+), 25 deletions(-)
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index d1f907f4757d..3f735ca0415e 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -291,9 +291,6 @@ struct z_erofs_decompress_frontend {
.inode = __i, .owned_head = Z_EROFS_PCLUSTER_TAIL, \
.mode = Z_EROFS_PCLUSTER_FOLLOWED, .backmost = true }
-static struct page *z_pagemap_global[Z_EROFS_VMAP_GLOBAL_PAGES];
-static DEFINE_MUTEX(z_pagemap_global_lock);
-
static void z_erofs_bind_cache(struct z_erofs_decompress_frontend *fe,
enum z_erofs_cache_alloctype type,
struct page **pagepool)
@@ -966,26 +963,11 @@ static int z_erofs_decompress_pcluster(struct super_block *sb,
mutex_lock(&pcl->lock);
nr_pages = pcl->nr_pages;
- if (nr_pages <= Z_EROFS_VMAP_ONSTACK_PAGES) {
+ if (nr_pages <= Z_EROFS_VMAP_ONSTACK_PAGES)
pages = pages_onstack;
- } else if (nr_pages <= Z_EROFS_VMAP_GLOBAL_PAGES &&
- mutex_trylock(&z_pagemap_global_lock)) {
- pages = z_pagemap_global;
- } else {
- gfp_t gfp_flags = GFP_KERNEL;
-
- if (nr_pages > Z_EROFS_VMAP_GLOBAL_PAGES)
- gfp_flags |= __GFP_NOFAIL;
-
+ else
pages = kvmalloc_array(nr_pages, sizeof(struct page *),
- gfp_flags);
-
- /* fallback to global pagemap for the lowmem scenario */
- if (!pages) {
- mutex_lock(&z_pagemap_global_lock);
- pages = z_pagemap_global;
- }
- }
+ GFP_KERNEL | __GFP_NOFAIL);
for (i = 0; i < nr_pages; ++i)
pages[i] = NULL;
@@ -1065,9 +1047,7 @@ static int z_erofs_decompress_pcluster(struct super_block *sb,
z_erofs_onlinepage_endio(page);
}
- if (pages == z_pagemap_global)
- mutex_unlock(&z_pagemap_global_lock);
- else if (pages != pages_onstack)
+ if (pages != pages_onstack)
kvfree(pages);
pcl->nr_pages = 0;
diff --git a/fs/erofs/zdata.h b/fs/erofs/zdata.h
index 75f6fd435388..43c91bd2d84f 100644
--- a/fs/erofs/zdata.h
+++ b/fs/erofs/zdata.h
@@ -175,6 +175,5 @@ static inline void z_erofs_onlinepage_endio(struct page *page)
#define Z_EROFS_VMAP_ONSTACK_PAGES \
min_t(unsigned int, THREAD_SIZE / 8 / sizeof(struct page *), 96U)
-#define Z_EROFS_VMAP_GLOBAL_PAGES 2048
#endif
--
2.24.4
next prev parent reply other threads:[~2022-07-15 15:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-15 15:41 [PATCH v2 00/16] erofs: prepare for folios, deduplication and kill PG_error Gao Xiang
2022-07-15 15:41 ` [PATCH v2 01/16] erofs: get rid of unneeded `inode', `map' and `sb' Gao Xiang
2022-07-15 15:41 ` [PATCH v2 02/16] erofs: clean up z_erofs_collector_begin() Gao Xiang
2022-07-15 15:41 ` [PATCH v2 03/16] erofs: introduce `z_erofs_parse_out_bvecs()' Gao Xiang
2022-07-15 15:41 ` [PATCH v2 04/16] erofs: introduce bufvec to store decompressed buffers Gao Xiang
2022-07-15 15:41 ` [PATCH v2 05/16] erofs: drop the old pagevec approach Gao Xiang
2022-07-15 15:41 ` [PATCH v2 06/16] erofs: introduce `z_erofs_parse_in_bvecs' Gao Xiang
2022-07-15 15:41 ` [PATCH v2 07/16] erofs: switch compressed_pages[] to bufvec Gao Xiang
2022-07-15 15:41 ` [PATCH v2 08/16] erofs: rework online page handling Gao Xiang
2022-07-15 15:41 ` [PATCH v2 09/16] erofs: get rid of `enum z_erofs_page_type' Gao Xiang
2022-07-15 15:41 ` [PATCH v2 10/16] erofs: clean up `enum z_erofs_collectmode' Gao Xiang
2022-07-15 15:41 ` Gao Xiang [this message]
2022-07-15 15:41 ` [PATCH v2 12/16] erofs: introduce struct z_erofs_decompress_backend Gao Xiang
2022-07-15 15:42 ` [PATCH v2 13/16] erofs: try to leave (de)compressed_pages on stack if possible Gao Xiang
2022-07-15 15:42 ` [PATCH v2 14/16] erofs: introduce z_erofs_do_decompressed_bvec() Gao Xiang
2022-07-15 15:42 ` [PATCH v2 15/16] erofs: record the longest decompressed size in this round Gao Xiang
2022-07-15 15:42 ` [PATCH v2 16/16] erofs: introduce multi-reference pclusters (fully-referenced) Gao Xiang
2022-07-21 14:31 ` [PATCH v2 00/16] erofs: prepare for folios, deduplication and kill PG_error Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220715154203.48093-12-hsiangkao@linux.alibaba.com \
--to=hsiangkao@linux.alibaba.com \
--cc=chao@kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®