From: Colin Watson <cjwatson@debian.org>
To: grub-devel@gnu.org
Cc: Vladimir Serbinenko <phcoder@gmail.com>
Subject: [PATCH] kern/dl: Disable grub_dl_unload_unneeded
Date: Sat, 20 Mar 2021 01:22:44 +0000 [thread overview]
Message-ID: <20210320012244.GA4330@riva.ucam.org> (raw)
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
next reply other threads:[~2021-03-20 1:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-20 1:22 Colin Watson [this message]
2021-03-23 17:52 ` [PATCH] kern/dl: Disable grub_dl_unload_unneeded Daniel Kiper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210320012244.GA4330@riva.ucam.org \
--to=cjwatson@debian.org \
--cc=grub-devel@gnu.org \
--cc=phcoder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.