[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJuCfpEdkVkeBvHyusiY8XQaM22vP_LZr9LnWxesHMt7f=No4g@mail.gmail.com>
Date: Tue, 15 Oct 2024 15:59:23 -0700
From: Suren Baghdasaryan <surenb@...gle.com>
To: Shakeel Butt <shakeel.butt@...ux.dev>
Cc: Andrew Morton <akpm@...ux-foundation.org>, kent.overstreet@...ux.dev, corbet@....net,
arnd@...db.de, mcgrof@...nel.org, rppt@...nel.org, paulmck@...nel.org,
thuth@...hat.com, tglx@...utronix.de, bp@...en8.de,
xiongwei.song@...driver.com, ardb@...nel.org, david@...hat.com,
vbabka@...e.cz, mhocko@...e.com, hannes@...xchg.org, roman.gushchin@...ux.dev,
dave@...olabs.net, willy@...radead.org, liam.howlett@...cle.com,
pasha.tatashin@...een.com, souravpanda@...gle.com, keescook@...omium.org,
dennis@...nel.org, jhubbard@...dia.com, yuzhao@...gle.com, vvvvvv@...gle.com,
rostedt@...dmis.org, iamjoonsoo.kim@....com, rientjes@...gle.com,
minchan@...gle.com, kaleshsingh@...gle.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org, linux-mm@...ck.org,
linux-modules@...r.kernel.org, kernel-team@...roid.com
Subject: Re: [PATCH v3 2/5] alloc_tag: load module tags into separate
contiguous memory
On Tue, Oct 15, 2024 at 2:08 PM Shakeel Butt <shakeel.butt@...ux.dev> wrote:
>
> On Mon, Oct 14, 2024 at 07:10:56PM GMT, Suren Baghdasaryan wrote:
> > On Mon, Oct 14, 2024 at 4:51 PM Andrew Morton <akpm@...ux-foundation.org> wrote:
> > >
> > > On Mon, 14 Oct 2024 13:36:43 -0700 Suren Baghdasaryan <surenb@...gle.com> wrote:
> > >
> > > > When a module gets unloaded there is a possibility that some of the
> > > > allocations it made are still used and therefore the allocation tags
> > > > corresponding to these allocations are still referenced. As such, the
> > > > memory for these tags can't be freed. This is currently handled as an
> > > > abnormal situation and module's data section is not being unloaded.
> > > > To handle this situation without keeping module's data in memory,
> > > > allow codetags with longer lifespan than the module to be loaded into
> > > > their own separate memory. The in-use memory areas and gaps after
> > > > module unloading in this separate memory are tracked using maple trees.
> > > > Allocation tags arrange their separate memory so that it is virtually
> > > > contiguous and that will allow simple allocation tag indexing later on
> > > > in this patchset. The size of this virtually contiguous memory is set
> > > > to store up to 100000 allocation tags.
> > > >
> > > > ...
> > > >
> > > > --- a/kernel/module/main.c
> > > > +++ b/kernel/module/main.c
> > > > @@ -1254,22 +1254,17 @@ static int module_memory_alloc(struct module *mod, enum mod_mem_type type)
> > > > return 0;
> > > > }
> > > >
> > > > -static void module_memory_free(struct module *mod, enum mod_mem_type type,
> > > > - bool unload_codetags)
> > > > +static void module_memory_free(struct module *mod, enum mod_mem_type type)
> > > > {
> > > > struct module_memory *mem = &mod->mem[type];
> > > > - void *ptr = mem->base;
> > > >
> > > > if (mem->is_rox)
> > > > vfree(mem->rw_copy);
> > > >
> > > > - if (!unload_codetags && mod_mem_type_is_core_data(type))
> > > > - return;
> > > > -
> > > > - execmem_free(ptr);
> > > > + execmem_free(mem->base);
> > > > }
> > >
> > > The changes around here are dependent upon Mike's "module: make
> > > module_memory_{alloc,free} more self-contained", which is no longer in
> > > mm-unstable. I assume Mike is working on a v2 so I'll park this series
> > > for now.
> >
> > Looks like the last update on Mike's patchset was back in May. Let me
> > check with Mike if he is planning to get it out soon. I would like my
> > patchset to get into 6.12 if possible.
>
> 6.12 or 6.13?
Right, it's 6.13 at this point.
Powered by blists - more mailing lists