From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2DEBC43334 for ; Sat, 16 Jul 2022 23:17:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232951AbiGPXRc (ORCPT ); Sat, 16 Jul 2022 19:17:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232725AbiGPXRV (ORCPT ); Sat, 16 Jul 2022 19:17:21 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86518205E2 for ; Sat, 16 Jul 2022 16:17:20 -0700 (PDT) Message-ID: <20220716230952.961938321@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1658013438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=p8GTJK4uVYYWM5yuu2sRowR6EatmieQ3CSBXbtGpA7Y=; b=aKGmpOd9sTKxdTKiJrrxBYpom9/s95YW6pVGZJ0lCejgk5Bd4nXs3he7YeTNvexFk1IOQT qnyUYiguuaJ2bLMiNR+EYcOu5FcLLb6fREYyNHcpHnmjcC0aWYRNV9nXI744dL+fvztI+q xjTBdxF6PmLfh8WgWciXYC0jNvYwjkgBYSwdLo9CcC7I3RU7oTCinB8OTVSEBWRgp6wUww xE9eW5MDU0wUKBZquB/gWn6KZExqyOK5DmJDYD1neDjSZbOLigt18aXKKymGz9hD9iJrkE CQePDho/UnoqHuub+a/ISYHQN4n7xr7UoMelJX52XKMBzAdKDRxSkwXWJiH3pw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1658013438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=p8GTJK4uVYYWM5yuu2sRowR6EatmieQ3CSBXbtGpA7Y=; b=CJ/Bj37JqHXtrkPxCzWul5ExTkkfB0MEIecJTARcSh8rCbrzSiVBCJifeln5nfCED6l8mS UAiwzCIQLmfo49DQ== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Linus Torvalds , Tim Chen , Josh Poimboeuf , Andrew Cooper , Pawan Gupta , Johannes Wikner , Alyssa Milburn , Jann Horn , "H.J. Lu" , Joao Moreira , Joseph Nuzman , Steven Rostedt Subject: [patch 05/38] btree: Initialize early when builtin References: <20220716230344.239749011@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Sun, 17 Jul 2022 01:17:17 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org An upcoming user of btree needs it early on. Initialize it in start_kernel(). Signed-off-by: Thomas Gleixner --- include/linux/btree.h | 6 ++++++ init/main.c | 2 ++ lib/btree.c | 8 +++++++- 3 files changed, 15 insertions(+), 1 deletion(-) --- a/include/linux/btree.h +++ b/include/linux/btree.h @@ -5,6 +5,12 @@ #include #include +#if IS_BUILTIN(CONFIG_BTREE) +extern void btree_cache_init(void); +#else +static inline void btree_cache_init(void) {} +#endif + /** * DOC: B+Tree basics * --- a/init/main.c +++ b/init/main.c @@ -75,6 +75,7 @@ #include #include #include +#include #include #include #include @@ -1125,6 +1126,7 @@ asmlinkage __visible void __init __no_sa cgroup_init(); taskstats_init_early(); delayacct_init(); + btree_cache_init(); poking_init(); check_bugs(); --- a/lib/btree.c +++ b/lib/btree.c @@ -787,15 +787,21 @@ static int __init btree_module_init(void return 0; } +#if IS_MODULE(CONFIG_BTREE) static void __exit btree_module_exit(void) { kmem_cache_destroy(btree_cachep); } -/* If core code starts using btree, initialization should happen even earlier */ module_init(btree_module_init); module_exit(btree_module_exit); MODULE_AUTHOR("Joern Engel "); MODULE_AUTHOR("Johannes Berg "); MODULE_LICENSE("GPL"); +#else +void __init btree_cache_init(void) +{ + BUG_ON(btree_module_init()); +} +#endif