[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW4snf6cBYSDRbALSNM4OE36-dusir8HQQ90Li7u067ZWA@mail.gmail.com>
Date: Fri, 20 Jan 2023 09:42:26 -0800
From: Song Liu <song@...nel.org>
To: Christoph Hellwig <hch@....de>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Luis Chamberlain <mcgrof@...nel.org>,
Christophe Leroy <christophe.leroy@...roup.eu>,
songliubraving@...com, Peter Zijlstra <peterz@...radead.org>,
linux-modules@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH/RFC] module: replace module_layout with module_memory
On Thu, Jan 19, 2023 at 12:29 AM Song Liu <song@...nel.org> wrote:
>
> On Wed, Jan 18, 2023 at 9:35 PM Christoph Hellwig <hch@....de> wrote:
> >
> > On Wed, Jan 18, 2023 at 01:52:51PM -0800, Song Liu wrote:
> > > 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.
> >
> > Just use the array please instead of making it too ugly. If that
> > is the only sensible way to iterate we have a good argument for the
> > array and can live with it.
>
> Hmm.. I think it won't be ugly outside of the struct definition...
> Alternatively, how about use something like
>
> #define core_text mod_mem[MOD_MEM_TYPE_TEXT]
> ...
>
> which is similar to
>
> struct sock {
> /*
> * Now struct inet_timewait_sock also uses sock_common, so please just
> * don't add nothing before this first member (__sk_common) --acme
> */
> struct sock_common __sk_common;
> #define sk_node __sk_common.skc_node
> #define sk_nulls_node __sk_common.skc_nulls_node
> ...
> };
So here are the two versions, both with secondary addr_[min|max] for
CONFIG_ARCH_WANTS_MODULES_DATA_IN_VMALLOC.
v2. Just use mod_mem array:
https://git.kernel.org/pub/scm/linux/kernel/git/song/md.git/commit/?h=remotes/song-md/new_module_alloc_build_test_v2
v3. mod_mem array and the defines:
#define mod_core_text mod_mem[MOD_MEM_TYPE_TEXT]
#define mod_core_data mod_mem[MOD_MEM_TYPE_DATA]
etc.
https://git.kernel.org/pub/scm/linux/kernel/git/song/md.git/commit/?h=remotes/song-md/new_module_alloc_build_test_v3
I personally like the v3 better. Please share you
comments on this.
Thanks,
Song
Powered by blists - more mailing lists