linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Freeing alternatives sections after module init?
@ 2016-06-27 21:07 Jessica Yu
  2016-06-28 20:33 ` Rusty Russell
  0 siblings, 1 reply; 2+ messages in thread
From: Jessica Yu @ 2016-06-27 21:07 UTC (permalink / raw)
  To: Rusty Russell; +Cc: linux-kernel

Hi Rusty,

I noticed that the module loader keeps .altinstructions and
.altinstr_replacement (which are normally freed after kernel init) in
core memory after module init, so these sections are never freed for
modules.

In fact, the module loader seems to keep a number of sections normally
marked between __init_begin and __init_end (which are then freed in
free_initmem()) in module core memory, for example on x86, there's
also .parainstructions and .altinstr_aux.

I was just wondering if this discrepancy was intentional :-)
Shouldn't these sections be freed after init? Though it probably
doesn't hurt to keep some of these sections in memory,
.altinstr_replacement is (for whatever reason) an executable section,
and is technically not needed anymore after apply_alternatives()
copies the replacement instructions, so it might be good to free it.

Thanks,
Jessica

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Freeing alternatives sections after module init?
  2016-06-27 21:07 Freeing alternatives sections after module init? Jessica Yu
@ 2016-06-28 20:33 ` Rusty Russell
  0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2016-06-28 20:33 UTC (permalink / raw)
  To: Jessica Yu; +Cc: linux-kernel

Jessica Yu <jeyu@redhat.com> writes:
> Hi Rusty,

Hi Jessica,

> I noticed that the module loader keeps .altinstructions and
> .altinstr_replacement (which are normally freed after kernel init) in
> core memory after module init, so these sections are never freed for
> modules.
>
> In fact, the module loader seems to keep a number of sections normally
> marked between __init_begin and __init_end (which are then freed in
> free_initmem()) in module core memory, for example on x86, there's
> also .parainstructions and .altinstr_aux.
>
> I was just wondering if this discrepancy was intentional :-)
> Shouldn't these sections be freed after init? Though it probably
> doesn't hurt to keep some of these sections in memory,
> .altinstr_replacement is (for whatever reason) an executable section,
> and is technically not needed anymore after apply_alternatives()
> copies the replacement instructions, so it might be good to free it.

No intention on my part!  Definitely nice to fix; I look forward to your
patch.

And sorry for the delay on review of ro_after_init; I'll look at it
today I promise!

Cheers,
Rusty.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-28 21:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-27 21:07 Freeing alternatives sections after module init? Jessica Yu
2016-06-28 20:33 ` Rusty Russell

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).