|
|
fd0330 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
fd0330 |
From: Patrick Steinhardt <ps@pks.im>
|
|
|
fd0330 |
Date: Thu, 21 Apr 2022 15:24:17 +1000
|
|
|
fd0330 |
Subject: [PATCH] mm: Drop unused unloading of modules on OOM
|
|
|
fd0330 |
|
|
|
fd0330 |
In grub_memalign(), there's a commented section which would allow for
|
|
|
fd0330 |
unloading of unneeded modules in case where there is not enough free
|
|
|
fd0330 |
memory available to satisfy a request. Given that this code is never
|
|
|
fd0330 |
compiled in, let's remove it together with grub_dl_unload_unneeded().
|
|
|
fd0330 |
|
|
|
fd0330 |
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
|
|
fd0330 |
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
|
|
fd0330 |
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
|
fd0330 |
Tested-by: Patrick Steinhardt <ps@pks.im>
|
|
|
fd0330 |
(cherry picked from commit 139fd9b134a01e0b5fe0ebefafa7f48d1ffb6d60)
|
|
|
fd0330 |
---
|
|
|
fd0330 |
grub-core/kern/dl.c | 20 --------------------
|
|
|
fd0330 |
grub-core/kern/mm.c | 8 --------
|
|
|
fd0330 |
include/grub/dl.h | 1 -
|
|
|
fd0330 |
3 files changed, 29 deletions(-)
|
|
|
fd0330 |
|
|
|
fd0330 |
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
|
|
|
fd0330 |
index d5de80186f..ab9101a5ad 100644
|
|
|
fd0330 |
--- a/grub-core/kern/dl.c
|
|
|
fd0330 |
+++ b/grub-core/kern/dl.c
|
|
|
fd0330 |
@@ -998,23 +998,3 @@ grub_dl_unload (grub_dl_t mod)
|
|
|
fd0330 |
grub_free (mod);
|
|
|
fd0330 |
return 1;
|
|
|
fd0330 |
}
|
|
|
fd0330 |
-
|
|
|
fd0330 |
-/* Unload unneeded modules. */
|
|
|
fd0330 |
-void
|
|
|
fd0330 |
-grub_dl_unload_unneeded (void)
|
|
|
fd0330 |
-{
|
|
|
fd0330 |
- /* Because grub_dl_remove modifies the list of modules, this
|
|
|
fd0330 |
- implementation is tricky. */
|
|
|
fd0330 |
- grub_dl_t p = grub_dl_head;
|
|
|
fd0330 |
-
|
|
|
fd0330 |
- while (p)
|
|
|
fd0330 |
- {
|
|
|
fd0330 |
- if (grub_dl_unload (p))
|
|
|
fd0330 |
- {
|
|
|
fd0330 |
- p = grub_dl_head;
|
|
|
fd0330 |
- continue;
|
|
|
fd0330 |
- }
|
|
|
fd0330 |
-
|
|
|
fd0330 |
- p = p->next;
|
|
|
fd0330 |
- }
|
|
|
fd0330 |
-}
|
|
|
fd0330 |
diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c
|
|
|
fd0330 |
index 38bfb01df9..1825dc8289 100644
|
|
|
fd0330 |
--- a/grub-core/kern/mm.c
|
|
|
fd0330 |
+++ b/grub-core/kern/mm.c
|
|
|
fd0330 |
@@ -444,14 +444,6 @@ grub_memalign (grub_size_t align, grub_size_t size)
|
|
|
fd0330 |
count++;
|
|
|
fd0330 |
goto again;
|
|
|
fd0330 |
|
|
|
fd0330 |
-#if 0
|
|
|
fd0330 |
- case 1:
|
|
|
fd0330 |
- /* Unload unneeded modules. */
|
|
|
fd0330 |
- grub_dl_unload_unneeded ();
|
|
|
fd0330 |
- count++;
|
|
|
fd0330 |
- goto again;
|
|
|
fd0330 |
-#endif
|
|
|
fd0330 |
-
|
|
|
fd0330 |
default:
|
|
|
fd0330 |
break;
|
|
|
fd0330 |
}
|
|
|
fd0330 |
diff --git a/include/grub/dl.h b/include/grub/dl.h
|
|
|
fd0330 |
index 45ac8e339f..6bc2560bf0 100644
|
|
|
fd0330 |
--- a/include/grub/dl.h
|
|
|
fd0330 |
+++ b/include/grub/dl.h
|
|
|
fd0330 |
@@ -206,7 +206,6 @@ grub_dl_t EXPORT_FUNC(grub_dl_load) (const char *name);
|
|
|
fd0330 |
grub_dl_t grub_dl_load_core (void *addr, grub_size_t size);
|
|
|
fd0330 |
grub_dl_t EXPORT_FUNC(grub_dl_load_core_noinit) (void *addr, grub_size_t size);
|
|
|
fd0330 |
int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod);
|
|
|
fd0330 |
-extern void grub_dl_unload_unneeded (void);
|
|
|
fd0330 |
extern int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
|
|
|
fd0330 |
extern int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
|
|
|
fd0330 |
extern int EXPORT_FUNC(grub_dl_ref_count) (grub_dl_t mod);
|