* [PATCH] kern/dl: Disable grub_dl_unload_unneeded
@ 2021-03-20 1:22 Colin Watson
2021-03-23 17:52 ` Daniel Kiper
0 siblings, 1 reply; 2+ messages in thread
From: Colin Watson @ 2021-03-20 1:22 UTC (permalink / raw)
To: grub-devel; +Cc: Vladimir Serbinenko
grub_dl_unload_unneeded has been unused by default since de04eecfa9 put
its only call within an "#if 0", so there's no point in it sitting
around taking up space in the core image. Turn the "#if 0" into "#ifdef
GRUB_UNLOAD_UNNEEDED_MODULES" just in case somebody is turning this code
back on locally for some reason, and guard all the relevant code with it
rather than just the call in grub_memalign.
DOWN: obj/i386-pc/grub-core/kernel.img (31740 > 31708) - change: -32
DOWN: i386-pc core image (biosdisk ext2 part_msdos) (27453 > 27430) - change: -23
DOWN: i386-pc core image (biosdisk ext2 part_msdos diskfilter mdraid09) (32367 > 32334) - change: -33
DOWN: i386-pc core image (biosdisk ext2 part_msdos lvm mdraid1x) (35595 > 35594) - change: -1
Signed-off-by: Colin Watson <cjwatson@debian.org>
---
grub-core/kern/dl.c | 2 ++
grub-core/kern/mm.c | 2 +-
include/grub/dl.h | 2 ++
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index 48f8a7907..88cd2fddc 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -804,6 +804,7 @@ grub_dl_unload (grub_dl_t mod)
return 1;
}
+#ifdef GRUB_UNLOAD_UNNEEDED_MODULES
/* Unload unneeded modules. */
void
grub_dl_unload_unneeded (void)
@@ -823,3 +824,4 @@ grub_dl_unload_unneeded (void)
p = p->next;
}
}
+#endif
diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c
index c070afc62..a913d66bf 100644
--- a/grub-core/kern/mm.c
+++ b/grub-core/kern/mm.c
@@ -360,7 +360,7 @@ grub_memalign (grub_size_t align, grub_size_t size)
count++;
goto again;
-#if 0
+#ifdef GRUB_UNLOAD_UNNEEDED_MODULES
case 1:
/* Unload unneeded modules. */
grub_dl_unload_unneeded ();
diff --git a/include/grub/dl.h b/include/grub/dl.h
index b3753c9ca..4a0712406 100644
--- a/include/grub/dl.h
+++ b/include/grub/dl.h
@@ -203,7 +203,9 @@ grub_dl_t EXPORT_FUNC(grub_dl_load) (const char *name);
grub_dl_t grub_dl_load_core (void *addr, grub_size_t size);
grub_dl_t EXPORT_FUNC(grub_dl_load_core_noinit) (void *addr, grub_size_t size);
int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod);
+#ifdef GRUB_UNLOAD_UNNEEDED_MODULES
extern void grub_dl_unload_unneeded (void);
+#endif
extern int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
extern int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
extern int EXPORT_FUNC(grub_dl_ref_count) (grub_dl_t mod);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kern/dl: Disable grub_dl_unload_unneeded
2021-03-20 1:22 [PATCH] kern/dl: Disable grub_dl_unload_unneeded Colin Watson
@ 2021-03-23 17:52 ` Daniel Kiper
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Kiper @ 2021-03-23 17:52 UTC (permalink / raw)
To: Colin Watson; +Cc: grub-devel, Vladimir Serbinenko
On Sat, Mar 20, 2021 at 01:22:44AM +0000, Colin Watson wrote:
> grub_dl_unload_unneeded has been unused by default since de04eecfa9 put
> its only call within an "#if 0", so there's no point in it sitting
> around taking up space in the core image. Turn the "#if 0" into "#ifdef
> GRUB_UNLOAD_UNNEEDED_MODULES" just in case somebody is turning this code
> back on locally for some reason, and guard all the relevant code with it
> rather than just the call in grub_memalign.
I would drop this function entirely. If somebody needs it they can
restore it from git history.
Daniel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-23 18:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-20 1:22 [PATCH] kern/dl: Disable grub_dl_unload_unneeded Colin Watson
2021-03-23 17:52 ` Daniel Kiper
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.