From: Youling Tang <youling.tang@linux.dev>
To: Christoph Hellwig <hch@infradead.org>,
Theodore Ts'o <tytso@mit.edu>, David Sterba <dsterba@suse.cz>,
Arnd Bergmann <arnd@arndb.de>
Cc: kreijack@inwind.it, Luis Chamberlain <mcgrof@kernel.org>,
Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
Andreas Dilger <adilger.kernel@dilger.ca>,
Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org>,
Linux-Arch <linux-arch@vger.kernel.org>,
linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org,
linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
Youling Tang <tangyouling@kylinos.cn>
Subject: Re: [PATCH 1/4] module: Add module_subinit{_noexit} and module_subeixt helper macros
Date: Mon, 29 Jul 2024 09:46:17 +0800 [thread overview]
Message-ID: <23862652-a702-4a5d-b804-db9ee9f6f539@linux.dev> (raw)
In-Reply-To: <20240727145232.GA377174@mit.edu>
On 27/07/2024 22:52, Theodore Ts'o wrote:
> On Fri, Jul 26, 2024 at 11:09:02AM -0700, Christoph Hellwig wrote:
>> On Fri, Jul 26, 2024 at 01:58:00PM -0400, Theodore Ts'o wrote:
>>> Yeah, that's my reaction as well. This only saves 50 lines of code in
>>> ext4, and that includes unrelated changes such as getting rid of "int
>>> i" and putting the declaration into the for loop --- "for (int i =
>>> ..."). Sure, that saves two lines of code, but yay?
>>>
>>> If the ordering how the functions gets called is based on the magic
>>> ordering in the Makefile, I'm not sure this actually makes the code
>>> clearer, more robust, and easier to maintain for the long term.
>> So you two object to kernel initcalls for the same reason and would
>> rather go back to calling everything explicitly?
> I don't oject to kernel initcalls which don't have any
> interdependencies and where ordering doesn't matter.
1. Previous version implementation: array mode (see link 1) :
Advantages:
- Few changes, simple principle, easy to understand code.
Disadvantages:
- Each modified module needs to maintain an array, more code.
2. Current implementation: explicit call subinit in initcall (see link 2) :
Advantages:
- Direct use of helpes macros, the subinit call sequence is
intuitive, and the implementation is relatively simple.
Disadvantages:
- helper macros need to be implemented compared to array mode.
3. Only one module_subinit per file (not implemented, see link 3) :
Advantage:
- No need to display to call subinit.
Disadvantages:
- Magic order based on Makefile makes code more fragile,
- Make sure that each file has only one module_subinit,
- It is not intuitive to know which subinits the module needs
and in what order (grep and Makefile are required),
- With multiple subinits per module, it would be difficult to
define module_{subinit, subexit} by MODULE, and difficult to
rollback when initialization fails (I haven't found a good way
to do this yet).
Personally, I prefer the implementation of method two.
Links:
[1]:
https://lore.kernel.org/all/20240711074859.366088-4-youling.tang@linux.dev/
[2]:
https://lore.kernel.org/all/20240723083239.41533-2-youling.tang@linux.dev/
[3]: https://lore.kernel.org/all/ZqKreStOD-eRkKZU@infradead.org/
Thanks,
Youling.
WARNING: multiple messages have this Message-ID (diff)
From: Youling Tang <youling.tang@linux.dev>
To: Christoph Hellwig <hch@infradead.org>,
Theodore Ts'o <tytso@mit.edu>, David Sterba <dsterba@suse.cz>,
Arnd Bergmann <arnd@arndb.de>
Cc: Linux-Arch <linux-arch@vger.kernel.org>,
Youling Tang <tangyouling@kylinos.cn>,
linux-f2fs-devel@lists.sourceforge.net, kreijack@inwind.it,
Josef Bacik <josef@toxicpanda.com>,
linux-kernel@vger.kernel.org, Chris Mason <clm@fb.com>,
Luis Chamberlain <mcgrof@kernel.org>,
Andreas Dilger <adilger.kernel@dilger.ca>,
linux-btrfs@vger.kernel.org, David Sterba <dsterba@suse.com>,
Jaegeuk Kim <jaegeuk@kernel.org>,
linux-ext4@vger.kernel.org, linux-modules@vger.kernel.org
Subject: Re: [f2fs-dev] [PATCH 1/4] module: Add module_subinit{_noexit} and module_subeixt helper macros
Date: Mon, 29 Jul 2024 09:46:17 +0800 [thread overview]
Message-ID: <23862652-a702-4a5d-b804-db9ee9f6f539@linux.dev> (raw)
In-Reply-To: <20240727145232.GA377174@mit.edu>
On 27/07/2024 22:52, Theodore Ts'o wrote:
> On Fri, Jul 26, 2024 at 11:09:02AM -0700, Christoph Hellwig wrote:
>> On Fri, Jul 26, 2024 at 01:58:00PM -0400, Theodore Ts'o wrote:
>>> Yeah, that's my reaction as well. This only saves 50 lines of code in
>>> ext4, and that includes unrelated changes such as getting rid of "int
>>> i" and putting the declaration into the for loop --- "for (int i =
>>> ..."). Sure, that saves two lines of code, but yay?
>>>
>>> If the ordering how the functions gets called is based on the magic
>>> ordering in the Makefile, I'm not sure this actually makes the code
>>> clearer, more robust, and easier to maintain for the long term.
>> So you two object to kernel initcalls for the same reason and would
>> rather go back to calling everything explicitly?
> I don't oject to kernel initcalls which don't have any
> interdependencies and where ordering doesn't matter.
1. Previous version implementation: array mode (see link 1) :
Advantages:
- Few changes, simple principle, easy to understand code.
Disadvantages:
- Each modified module needs to maintain an array, more code.
2. Current implementation: explicit call subinit in initcall (see link 2) :
Advantages:
- Direct use of helpes macros, the subinit call sequence is
intuitive, and the implementation is relatively simple.
Disadvantages:
- helper macros need to be implemented compared to array mode.
3. Only one module_subinit per file (not implemented, see link 3) :
Advantage:
- No need to display to call subinit.
Disadvantages:
- Magic order based on Makefile makes code more fragile,
- Make sure that each file has only one module_subinit,
- It is not intuitive to know which subinits the module needs
and in what order (grep and Makefile are required),
- With multiple subinits per module, it would be difficult to
define module_{subinit, subexit} by MODULE, and difficult to
rollback when initialization fails (I haven't found a good way
to do this yet).
Personally, I prefer the implementation of method two.
Links:
[1]:
https://lore.kernel.org/all/20240711074859.366088-4-youling.tang@linux.dev/
[2]:
https://lore.kernel.org/all/20240723083239.41533-2-youling.tang@linux.dev/
[3]: https://lore.kernel.org/all/ZqKreStOD-eRkKZU@infradead.org/
Thanks,
Youling.
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2024-07-29 1:46 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-23 8:32 [PATCH 0/4] Add module_subinit{_noexit} and module_subeixt helper macros Youling Tang
2024-07-23 8:32 ` [f2fs-dev] " Youling Tang
2024-07-23 8:32 ` [PATCH 1/4] module: " Youling Tang
2024-07-23 8:32 ` [f2fs-dev] " Youling Tang
2024-07-23 9:58 ` Mika Penttilä
2024-07-23 9:58 ` [f2fs-dev] " Mika Penttilä
2024-07-24 1:20 ` Youling Tang
2024-07-24 1:20 ` [f2fs-dev] " Youling Tang
2024-07-23 14:33 ` Christoph Hellwig
2024-07-23 14:33 ` [f2fs-dev] " Christoph Hellwig
2024-07-24 1:57 ` Youling Tang
2024-07-24 1:57 ` [f2fs-dev] " Youling Tang
2024-07-24 15:43 ` Christoph Hellwig
2024-07-24 15:43 ` [f2fs-dev] " Christoph Hellwig
2024-07-25 3:01 ` Youling Tang
2024-07-25 3:01 ` [f2fs-dev] " Youling Tang
2024-07-25 14:39 ` Christoph Hellwig
2024-07-25 14:39 ` [f2fs-dev] " Christoph Hellwig
2024-07-25 15:30 ` Arnd Bergmann
2024-07-25 15:30 ` [f2fs-dev] " Arnd Bergmann
2024-07-25 15:34 ` Christoph Hellwig
2024-07-25 15:34 ` [f2fs-dev] " Christoph Hellwig
2024-07-25 17:14 ` Goffredo Baroncelli
2024-07-25 17:14 ` [f2fs-dev] " Goffredo Baroncelli via Linux-f2fs-devel
2024-07-25 19:46 ` Christoph Hellwig
2024-07-25 19:46 ` [f2fs-dev] " Christoph Hellwig
2024-07-26 8:54 ` Youling Tang
2024-07-26 8:54 ` [f2fs-dev] " Youling Tang
2024-07-26 14:04 ` Christoph Hellwig
2024-07-26 14:04 ` [f2fs-dev] " Christoph Hellwig
2024-07-26 15:22 ` David Sterba
2024-07-26 15:22 ` [f2fs-dev] " David Sterba
2024-07-26 17:58 ` Theodore Ts'o
2024-07-26 17:58 ` [f2fs-dev] " Theodore Ts'o
2024-07-26 18:09 ` Christoph Hellwig
2024-07-26 18:09 ` [f2fs-dev] " Christoph Hellwig
2024-07-26 22:45 ` David Sterba
2024-07-26 22:45 ` [f2fs-dev] " David Sterba
2024-07-27 14:52 ` Theodore Ts'o
2024-07-27 14:52 ` [f2fs-dev] " Theodore Ts'o
2024-07-29 1:46 ` Youling Tang [this message]
2024-07-29 1:46 ` Youling Tang
2024-07-29 2:44 ` Theodore Ts'o
2024-07-29 2:44 ` [f2fs-dev] " Theodore Ts'o
2024-07-29 3:01 ` Youling Tang
2024-07-29 3:01 ` [f2fs-dev] " Youling Tang
2024-07-29 18:57 ` Christoph Hellwig
2024-07-29 18:57 ` [f2fs-dev] " Christoph Hellwig
2024-07-23 8:32 ` [PATCH 2/4] btrfs: Use " Youling Tang
2024-07-23 8:32 ` [f2fs-dev] " Youling Tang
2024-07-23 22:24 ` kernel test robot
2024-07-23 22:24 ` [f2fs-dev] " kernel test robot
2024-07-24 6:29 ` Youling Tang
2024-07-24 6:29 ` [f2fs-dev] " Youling Tang
2024-07-23 8:32 ` [PATCH 3/4] ext4: Use module_{subinit, subexit} " Youling Tang
2024-07-23 8:32 ` [f2fs-dev] " Youling Tang
2024-07-23 8:32 ` [PATCH 4/4] f2fs: Use module_{subinit, subeixt} " Youling Tang
2024-07-23 8:32 ` [f2fs-dev] " Youling Tang
2024-07-23 18:51 ` kernel test robot
2024-07-23 18:51 ` [f2fs-dev] " kernel test robot
2024-07-24 2:14 ` Youling Tang
2024-07-24 2:14 ` [f2fs-dev] " Youling Tang
2024-07-23 21:31 ` kernel test robot
2024-07-23 21:31 ` [f2fs-dev] " kernel test robot
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=23862652-a702-4a5d-b804-db9ee9f6f539@linux.dev \
--to=youling.tang@linux.dev \
--cc=adilger.kernel@dilger.ca \
--cc=arnd@arndb.de \
--cc=chao@kernel.org \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=dsterba@suse.cz \
--cc=hch@infradead.org \
--cc=jaegeuk@kernel.org \
--cc=josef@toxicpanda.com \
--cc=kreijack@inwind.it \
--cc=linux-arch@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=tangyouling@kylinos.cn \
--cc=tytso@mit.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.