Message ID | 20180324174458.26423-2-shea@shealevy.com (mailing list archive) |
---|---|
State | Awaiting Upstream |
Headers | show |
Shea Levy <shea@shealevy.com> a écrit : > Signed-off-by: Shea Levy <shea@shealevy.com> > --- > init/initramfs.c | 7 +++++++ > usr/Kconfig | 4 ++++ > 2 files changed, 11 insertions(+) > > diff --git a/init/initramfs.c b/init/initramfs.c > index 7e99a0038942..de5ce873eb5a 100644 > --- a/init/initramfs.c > +++ b/init/initramfs.c > @@ -526,6 +526,13 @@ extern unsigned long __initramfs_size; > #include <linux/initrd.h> > #include <linux/kexec.h> > > +#ifdef CONFIG_INITRAMFS_GENERIC_UNLOAD > +void free_initrd_mem(unsigned long start, unsigned long end) > +{ > + free_reserved_area((void *)start, (void *)end, -1, "initrd"); > +} > +#endif In powerpc this was an __init function. Why not also put the generic one in __init section ? Christophe > + > static void __init free_initrd(void) > { > #ifdef CONFIG_KEXEC_CORE > diff --git a/usr/Kconfig b/usr/Kconfig > index 43658b8a975e..fd79d4d6fa26 100644 > --- a/usr/Kconfig > +++ b/usr/Kconfig > @@ -233,3 +233,7 @@ config INITRAMFS_COMPRESSION > default ".lzma" if RD_LZMA > default ".bz2" if RD_BZIP2 > default "" > + > +# Arches can select this for a generic initrd unloading codepath > +config INITRAMFS_GENERIC_UNLOAD > + bool > -- > 2.16.2 -- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Christophe, LEROY Christophe <christophe.leroy@c-s.fr> writes: > Shea Levy <shea@shealevy.com> a écrit : > >> Signed-off-by: Shea Levy <shea@shealevy.com> >> --- >> init/initramfs.c | 7 +++++++ >> usr/Kconfig | 4 ++++ >> 2 files changed, 11 insertions(+) >> >> diff --git a/init/initramfs.c b/init/initramfs.c >> index 7e99a0038942..de5ce873eb5a 100644 >> --- a/init/initramfs.c >> +++ b/init/initramfs.c >> @@ -526,6 +526,13 @@ extern unsigned long __initramfs_size; >> #include <linux/initrd.h> >> #include <linux/kexec.h> >> >> +#ifdef CONFIG_INITRAMFS_GENERIC_UNLOAD >> +void free_initrd_mem(unsigned long start, unsigned long end) >> +{ >> + free_reserved_area((void *)start, (void *)end, -1, "initrd"); >> +} >> +#endif > > In powerpc this was an __init function. Why not also put the generic > one in __init section ? > v2 series sent, thanks! > > Christophe > > >> + >> static void __init free_initrd(void) >> { >> #ifdef CONFIG_KEXEC_CORE >> diff --git a/usr/Kconfig b/usr/Kconfig >> index 43658b8a975e..fd79d4d6fa26 100644 >> --- a/usr/Kconfig >> +++ b/usr/Kconfig >> @@ -233,3 +233,7 @@ config INITRAMFS_COMPRESSION >> default ".lzma" if RD_LZMA >> default ".bz2" if RD_BZIP2 >> default "" >> + >> +# Arches can select this for a generic initrd unloading codepath >> +config INITRAMFS_GENERIC_UNLOAD >> + bool >> -- >> 2.16.2
> +#ifdef CONFIG_INITRAMFS_GENERIC_UNLOAD > +void free_initrd_mem(unsigned long start, unsigned long end) > +{ > + free_reserved_area((void *)start, (void *)end, -1, "initrd"); > +} > +#endif Given how trivial this is and how many architectures can use it I'd reverse the polarity and add a CONFIG_HAVE_ARCH_FREE_INITRD_MEM instead. -- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Mar 28, 2018 at 2:04 PM, Christoph Hellwig <hch@infradead.org> wrote: >> +#ifdef CONFIG_INITRAMFS_GENERIC_UNLOAD >> +void free_initrd_mem(unsigned long start, unsigned long end) >> +{ >> + free_reserved_area((void *)start, (void *)end, -1, "initrd"); >> +} >> +#endif > > Given how trivial this is and how many architectures can use it I'd > reverse the polarity and add a CONFIG_HAVE_ARCH_FREE_INITRD_MEM > instead. And while adding "special" functionality to the generic version, more and more users of CONFIG_HAVE_ARCH_FREE_INITRD_MEM will be removed. Gr{oetje,eeting}s, Geert
diff --git a/init/initramfs.c b/init/initramfs.c index 7e99a0038942..de5ce873eb5a 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -526,6 +526,13 @@ extern unsigned long __initramfs_size; #include <linux/initrd.h> #include <linux/kexec.h> +#ifdef CONFIG_INITRAMFS_GENERIC_UNLOAD +void free_initrd_mem(unsigned long start, unsigned long end) +{ + free_reserved_area((void *)start, (void *)end, -1, "initrd"); +} +#endif + static void __init free_initrd(void) { #ifdef CONFIG_KEXEC_CORE diff --git a/usr/Kconfig b/usr/Kconfig index 43658b8a975e..fd79d4d6fa26 100644 --- a/usr/Kconfig +++ b/usr/Kconfig @@ -233,3 +233,7 @@ config INITRAMFS_COMPRESSION default ".lzma" if RD_LZMA default ".bz2" if RD_BZIP2 default "" + +# Arches can select this for a generic initrd unloading codepath +config INITRAMFS_GENERIC_UNLOAD + bool
Signed-off-by: Shea Levy <shea@shealevy.com> --- init/initramfs.c | 7 +++++++ usr/Kconfig | 4 ++++ 2 files changed, 11 insertions(+)