From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>, Nick Terrell <terrelln@fb.com>,
Chris Down <chris@chrisdown.name>,
Filipe Manana <fdmanana@suse.com>, Qu Wenruo <wqu@suse.com>,
Nikolay Borisov <nborisov@suse.com>,
Gabriel Niebler <gniebler@suse.com>,
Ira Weiny <ira.weiny@intel.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
Subject: [RFC PATCH v2 0/3] btrfs: Convert zlib.c to use kmap_local_page()
Date: Fri, 17 Jun 2022 14:05:35 +0200 [thread overview]
Message-ID: <20220617120538.18091-1-fmdefrancesco@gmail.com> (raw)
The use of kmap() is being deprecated in favor of kmap_local_page(). With
kmap_local_page(), the mapping is per thread, CPU local and not globally
visible.
Therefore, use kmap_local_page() / kunmap_local() in zlib.c because in
this file the mappings are per thread and are not visible in other
contexts.
This is an RFC because patch 3/3 uses an horrid hack. I'm using an array
based stack which tracks local mappings / un-mappings. I understand that
it is not the better solution, but it works and it is easy to implement :)
I've decided to decompose RFC v1 into a series of three patches in order to
make clear that I encountered problems with conversions in patch 3/3. I'm
pretty sure that people who are familiar with these functions could refactor
this code and provide much more elegant and efficient solutions.
Since this code currently uses kmap() / kunmap(), I think that the functions
I'm converting had been designed without taking into account the rules of
ordering of nesting local mappings / un-mappings.
I've been trying to refactor this code but it is something beyond my current
level of knowledge and skills...
Can anyone please provide any better suited solutions for patch 3/3?
Tested with xfstests on QEMU + KVM 32 bits VM with 4GB of RAM and
HIGHMEM64G enabled. Each patch of this series passes 26/26 tests of group
"compress".
tweed32:/usr/lib/xfstests # ./check -g compress
FSTYP -- btrfs
PLATFORM -- Linux/i686 tweed32 5.19.0-rc2-vanilla-debug+ #45 SMP PREEMPT_DYNAMIC Fri Jun 17 11:14:11 CEST 2022
MKFS_OPTIONS -- /dev/loop1
MOUNT_OPTIONS -- /dev/loop1 /mnt/scratch
btrfs/024 2s ... 3s
btrfs/026 5s ... 5s
btrfs/037 3s ... 3s
btrfs/038 3s ... 2s
btrfs/041 3s ... 3s
btrfs/062 41s ... 41s
btrfs/063 22s ... 23s
btrfs/067 39s ... 40s
btrfs/068 14s ... 14s
btrfs/070 [not run] btrfs and this test needs 5 or more disks in SCRATCH_DEV_POOL
btrfs/071 [not run] btrfs and this test needs 5 or more disks in SCRATCH_DEV_POOL
btrfs/072 39s ... 41s
btrfs/073 20s ... 20s
btrfs/074 41s ... 41s
btrfs/076 3s ... 3s
btrfs/103 3s ... 3s
btrfs/106 3s ... 3s
btrfs/109 3s ... 3s
btrfs/113 3s ... 3s
btrfs/138 53s ... 54s
btrfs/149 3s ... 3s
btrfs/183 3s ... 2s
btrfs/205 4s ... 3s
btrfs/234 4s ... 4s
btrfs/246 2s ... 3s
btrfs/251 3s ... 2s
Ran: btrfs/024 btrfs/026 btrfs/037 btrfs/038 btrfs/041 btrfs/062 btrfs/063 btrfs/067 btrfs/068 btrfs/070 btrfs/071 btrfs/072 btrfs/073 btrfs/074 btrfs/076 btrfs/103 btrfs/106 btrfs/109 btrfs/113 btrfs/138 btrfs/149 btrfs/183 btrfs/205 btrfs/234 btrfs/246 btrfs/251
Not run: btrfs/070 btrfs/071
Passed all 26 tests
Fabio M. De Francesco (3):
btrfs: Convert zlib_decompress_bio() to use kmap_local_page()
btrfs: Use kmap_local_page() on "out_page" in zlib_compress_pages()
btrfs: Use kmap_local_page() on "in_page" in zlib_compress_pages()
fs/btrfs/zlib.c | 91 ++++++++++++++++++++++++++++++++++++-------------
1 file changed, 67 insertions(+), 24 deletions(-)
--
2.36.1
next reply other threads:[~2022-06-17 12:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-17 12:05 Fabio M. De Francesco [this message]
2022-06-17 12:05 ` [RFC PATCH v2 1/3] btrfs: Convert zlib_decompress_bio() " Fabio M. De Francesco
2022-06-17 12:51 ` Qu Wenruo
2022-06-17 17:35 ` Fabio M. De Francesco
2022-06-17 12:05 ` [RFC PATCH v2 2/3] btrfs: Use kmap_local_page() on "out_page" in zlib_compress_pages() Fabio M. De Francesco
2022-06-17 12:54 ` Qu Wenruo
2022-06-17 17:46 ` Fabio M. De Francesco
2022-06-17 12:05 ` [RFC PATCH v2 3/3] btrfs: Use kmap_local_page() on "in_page" " Fabio M. De Francesco
2022-06-17 13:09 ` Qu Wenruo
2022-06-17 14:20 ` David Sterba
2022-06-17 18:25 ` Fabio M. De Francesco
2022-06-17 18:13 ` Fabio M. De Francesco
2022-06-17 22:16 ` Qu Wenruo
2022-06-18 9:04 ` Fabio M. De Francesco
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=20220617120538.18091-1-fmdefrancesco@gmail.com \
--to=fmdefrancesco@gmail.com \
--cc=chris@chrisdown.name \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=fdmanana@suse.com \
--cc=gniebler@suse.com \
--cc=ira.weiny@intel.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nborisov@suse.com \
--cc=terrelln@fb.com \
--cc=wqu@suse.com \
/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®