Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1maCFa-0007Fi-Ep for mharc-grub-devel@gnu.org; Tue, 12 Oct 2021 03:31:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maCFQ-0007AR-2W for grub-devel@gnu.org; Tue, 12 Oct 2021 03:30:52 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:43992) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1maCFO-0006bL-Ft for grub-devel@gnu.org; Tue, 12 Oct 2021 03:30:51 -0400 Received: by mail-pf1-x432.google.com with SMTP id 187so16877343pfc.10 for ; Tue, 12 Oct 2021 00:30:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qg8f+nhwCz6MREZr03hsYF0hUEe7qUwmpQ+9k2Ja2kg=; b=gnbSHzGllth/pAGYtoVlGuGCI5wZVYS8Q4gbcldx6FGQc190R/UJQDxvASAPG80QDC fvGi/m1iNLTQs6Uk3QDZFIWkif83P5FLxed8X5IGr85wAFPlqR1kUwl1dr94LEDeSN4j Oh1BkJ77R+zI4NXwZSZ0+iN9PFfv1aXrBfScQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qg8f+nhwCz6MREZr03hsYF0hUEe7qUwmpQ+9k2Ja2kg=; b=TlfmaYYEv8nKkR5/gvSn6J2gznUSX5AmI6qgXNQ7oNI8eUXqxNUhQmeL349aj57NtS pOccBa1h5BpDmseQe/LS3yIPClKuFGF2I0mfkN3kLC/zLg2GvkgjfHxDRoYMVwl+4wg8 CisW4EOGzxGq2Oj7ciinhGe6ppgigBseK+uwDL0BqchBU5i3/a2y0tfwHI6WqZ4zzLjw tUmpugEiGhknTKG9mjRQVgJvjWGWDDkHHCrgi0Y0O89wF6YqTd8yb0zbC3MP6/EPknqf 5TdfqqDsV0P0ihyMp3n/44fxICZrKGLoKBZs8PiPlJO47NoohVp+PqpJ/VE37b41Grmu F0Ww== X-Gm-Message-State: AOAM532W9uy4dVg1qFQMlI3XjLFxdpbX6Cw/MpSzrHuYEalXvM0XuJsb bhdP8xL7RWFWjwjdgcVTJYoL6kX5dnluJg== X-Google-Smtp-Source: ABdhPJyq5mk3ieGrPKSmcDhRGk/m9wvI5c3iILn3HMcqaL+RL59VfxeIKB/CQNyQMmWeHuGm2C09nA== X-Received: by 2002:a63:101c:: with SMTP id f28mr21501621pgl.330.1634023849026; Tue, 12 Oct 2021 00:30:49 -0700 (PDT) Received: from localhost ([2001:4479:e300:600:41fe:d15:934f:4029]) by smtp.gmail.com with ESMTPSA id g186sm10188471pfb.53.2021.10.12.00.30.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 00:30:48 -0700 (PDT) From: Daniel Axtens To: grub-devel@gnu.org Cc: leif@nuviainc.com, stefanb@linux.ibm.com, ps@pks.im, dkiper@net-space.pl Subject: [PATCH 08/19] mm: Drop unused unloading of modules on OOM Date: Tue, 12 Oct 2021 18:29:57 +1100 Message-Id: <20211012073008.4059133-9-dja@axtens.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211012073008.4059133-1-dja@axtens.net> References: <20211012073008.4059133-1-dja@axtens.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=dja@axtens.net; helo=mail-pf1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2021 07:30:52 -0000 From: Patrick Steinhardt 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 --- grub-core/kern/dl.c | 20 -------------------- grub-core/kern/mm.c | 8 -------- include/grub/dl.h | 1 - 3 files changed, 29 deletions(-) diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c index 48f8a79073dd..a62dbeebbfe9 100644 --- a/grub-core/kern/dl.c +++ b/grub-core/kern/dl.c @@ -803,23 +803,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; - } -} diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c index 032c8f71aed2..6038c0d0cbb2 100644 --- a/grub-core/kern/mm.c +++ b/grub-core/kern/mm.c @@ -377,14 +377,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; } diff --git a/include/grub/dl.h b/include/grub/dl.h index b3753c9ca262..536717776367 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -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); -- 2.30.2