From: Song Liu <song@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Luis Chamberlain <mcgrof@kernel.org>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
songliubraving@fb.com, Peter Zijlstra <peterz@infradead.org>,
linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH/RFC] module: replace module_layout with module_memory
Date: Wed, 18 Jan 2023 13:52:51 -0800 [thread overview]
Message-ID: <CAPhsuW7zqYgLcWoG1Wr_tBBLt-yiNYq3FLVWYMpMj=6TJawQEg@mail.gmail.com> (raw)
In-Reply-To: <20230118074047.GA27385@lst.de>
On Tue, Jan 17, 2023 at 11:40 PM Christoph Hellwig <hch@lst.de> wrote:
>
> On Tue, Jan 17, 2023 at 10:50:55AM -0800, Song Liu wrote:
> > Hi Thomas and Luis,
> >
> > Could you please share your comments on this? Specifically, is this on
> > the right direction? And, what's your preference with Christophe's
> > suggestions?
> >
> > "I dislike how it looks with enums, things like
> > mod->mod_mem[MOD_MEM_TYPE_INIT
> > _TEXT] are odd and don't read nicely.
> > Could we have something nicer like mod->mod_mem_init_text ?
> > I know it will complicate your for_each_mod_mem_type() but it would look
> > nicer."
>
> FYI, I don't particularly like the array either. But if it makes
> the code much simpler I can live with it.
How about we do something like this
struct module {
...
/* rbtree is accessed frequently, so keep together. */
union {
struct module_memory mod_mem[MOD_MEM_NUM_TYPES]
__module_memory_align;
struct {
/* keep the same order as enum mod_mem_type */
struct module_memory core_text;
struct module_memory core_data;
struct module_memory core_rodata;
struct module_memory core_ro_after_init;
struct module_memory init_text;
struct module_memory init_data;
struct module_memory init_rodata;
};
};
...
};
In this way we can use the array in the for loops, and use mod->core_text,
etc. when we only need to access one of them.
Thanks,
Song
PS: Do we need __no_randomize_layout somewhere?
next prev parent reply other threads:[~2023-01-18 21:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-06 22:09 [PATCH/RFC] module: replace module_layout with module_memory Song Liu
2023-01-09 18:03 ` Christophe Leroy
2023-01-09 18:24 ` Song Liu
2023-01-09 20:51 ` Song Liu
2023-01-10 6:31 ` Christophe Leroy
2023-01-10 6:51 ` Song Liu
2023-01-18 15:07 ` Peter Zijlstra
2023-01-18 17:52 ` Song Liu
2023-01-10 18:31 ` Song Liu
2023-01-17 18:50 ` Song Liu
2023-01-18 7:40 ` Christoph Hellwig
2023-01-18 17:37 ` Song Liu
2023-01-18 21:52 ` Song Liu [this message]
2023-01-19 5:35 ` Christoph Hellwig
2023-01-19 8:29 ` Song Liu
2023-01-20 17:42 ` Song Liu
2023-01-23 6:57 ` Christoph Hellwig
2023-01-24 18:01 ` Song Liu
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='CAPhsuW7zqYgLcWoG1Wr_tBBLt-yiNYq3FLVWYMpMj=6TJawQEg@mail.gmail.com' \
--to=song@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=peterz@infradead.org \
--cc=songliubraving@fb.com \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).