Skip to contentSkip to conversation

Add thread_info_cache_init() to all archs

PATCH New Benjamin Herrenschmidt 1 participant 1 message Apr 10, 2008

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

PATCH 1/2 Add thread_info_cache_init() to all archs

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 and adds an empty macro for when it's not implemented.

---

So we have the choice here between:

- the ifdef on the func name that I did, consistent with what
I did before for iomap, which iirc Linus liked

- add some more ARCH_HAS_* or HAVE_* (yuck)

- add an empty definition to all archs .h (pain in the neck but I
can do it, though it will be an annoying patch to keep around)

- do a weak function (will slightly bloat everybody for no good reason)

So unless there is strong complaints, I'd like to stick to my current approach.

(This one fixes a stupid typo, missing () in the macro def.)

 include/linux/sched.h |    4 ++++
 init/main.c           |    1 +
 2 files changed, 5 insertions(+)
init/main.c +1 -0
@@ -623,6 +623,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 +4 -0
Index: linux-work/include/linux/sched.h
===================================================================
@@ -1893,6 +1893,10 @@ static inline unsigned long *end_of_stac
 
 #endif
 
+#ifndef thread_info_cache_init
+#define thread_info_cache_init()	do { } while(0)
+#endif
+
 /* set thread flags in other task's structures
  * - see asm/thread_info.h for TIF_xxxx flags available
  */