Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1432316 > unrolled thread

Freeing alternatives sections after module init?

Started byJessica Yu <jeyu@redhat.com>
First post2016-06-27 23:10 +0200
Last post2016-06-28 23:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  Freeing alternatives sections after module init? Jessica Yu <jeyu@redhat.com> - 2016-06-27 23:10 +0200
    Re: Freeing alternatives sections after module init? Rusty Russell <rusty@rustcorp.com.au> - 2016-06-28 23:30 +0200

#1432316 — Freeing alternatives sections after module init?

FromJessica Yu <jeyu@redhat.com>
Date2016-06-27 23:10 +0200
SubjectFreeing alternatives sections after module init?
Message-ID<rOLX4-5DX-25@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1433336

FromRusty Russell <rusty@rustcorp.com.au>
Date2016-06-28 23:30 +0200
Message-ID<rP8JY-3Qa-27@gated-at.bofh.it>
In reply to#1432316
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web