Skip to contentSkip to conversation

Add thread_info_cache_init() weak hook

PATCH In review Benjamin Herrenschmidt 1 participant 1 message Apr 18, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Add thread_info_cache_init() weak hook

Some architecture need to maintain a kmem cache for thread info structures. (next patch adds that to powerpc to fix an alignment problem).

There is no good arch callback to use to initialize that cache that I can find, so this adds a new one in the form of a weak function whose default is empty.

---

 include/linux/sched.h |    2 ++
 init/main.c           |    5 +++++
 2 files changed, 7 insertions(+)
init/main.c +5 -0
@@ -504,6 +504,10 @@ void __init __attribute__((weak)) smp_se
 {
 }
 
+void __init __weak thread_info_cache_init(void)
+{
+}
+
 asmlinkage void __init start_kernel(void)
 {
 	char * command_line;
@@ -623,6 +627,7 @@ asmlinkage void __init start_kernel(void
 	if (efi_enabled)
 		efi_enter_virtual_mode();
 #endif
+	thread_info_cache_init();
 	fork_init(num_physpages);
 	proc_caches_init();
 	buffer_init();
include/linux/sched.h +2 -0
Index: linux-work/include/linux/sched.h
===================================================================
@@ -1893,6 +1893,8 @@ static inline unsigned long *end_of_stac
 
 #endif
 
+extern void thread_info_cache_init(void);
+
 /* set thread flags in other task's structures
  * - see asm/thread_info.h for TIF_xxxx flags available
  */