]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
mm: Drop unused unloading of modules on OOM
authorPatrick Steinhardt <ps@pks.im>
Thu, 21 Apr 2022 05:24:17 +0000 (15:24 +1000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Mon, 4 Jul 2022 12:25:41 +0000 (14:25 +0200)
In grub_memalign(), there's a commented section which would allow for
unloading of unneeded modules in case where there is not enough free
memory available to satisfy a request. Given that this code is never
compiled in, let's remove it together with grub_dl_unload_unneeded().

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Tested-by: Patrick Steinhardt <ps@pks.im>
grub-core/kern/dl.c
grub-core/kern/mm.c
include/grub/dl.h

index b1d3a103ec9828a7d97085bcc14280e92a3c62c9..e447fd0fab4e303b8656a4f5bcc1649021d18609 100644 (file)
@@ -811,23 +811,3 @@ grub_dl_unload (grub_dl_t mod)
   grub_free (mod);
   return 1;
 }
-
-/* Unload unneeded modules.  */
-void
-grub_dl_unload_unneeded (void)
-{
-  /* Because grub_dl_remove modifies the list of modules, this
-     implementation is tricky.  */
-  grub_dl_t p = grub_dl_head;
-
-  while (p)
-    {
-      if (grub_dl_unload (p))
-       {
-         p = grub_dl_head;
-         continue;
-       }
-
-      p = p->next;
-    }
-}
index 43d4e609f6b0a47c1b5608b480f9a4f83f02c76e..e859772ab2e38fb57bedfd080424cfd06f04f098 100644 (file)
@@ -444,14 +444,6 @@ grub_memalign (grub_size_t align, grub_size_t size)
       count++;
       goto again;
 
-#if 0
-    case 1:
-      /* Unload unneeded modules.  */
-      grub_dl_unload_unneeded ();
-      count++;
-      goto again;
-#endif
-
     default:
       break;
     }
index d0f4115fe736fc087edb010d8868be48aa12409c..acb4d42327d78ebd77d19e6e1b51a746acd67690 100644 (file)
@@ -203,7 +203,6 @@ 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);
-extern void grub_dl_unload_unneeded (void);
 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);