public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Add thread_info_cache_init() to all archs
@ 2008-04-10  3:22 Benjamin Herrenschmidt
  2008-04-10  3:22 ` Benjamin Herrenschmidt
       [not found] ` <20080410032354.90CB1DDF0F-mnsaURCQ41sdnm+yROfE0A@public.gmane.org>
  0 siblings, 2 replies; 32+ messages in thread
From: Benjamin Herrenschmidt @ 2008-04-10  3:22 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Paul Mackerras, linuxppc-dev-mnsaURCQ41sdnm+yROfE0A,
	takata-TMSiXQfHlQjsTix1lMzHGQ,
	linux-m32r-rQhvJZKUsGBRYuoOT4C5/9i2O/JbrIOy, Linux-Arch

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.

Signed-off-by: Benjamin Herrenschmidt <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
---

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.

 include/linux/sched.h |    4 ++++
 init/main.c           |    1 +
 2 files changed, 5 insertions(+)

--- linux-work.orig/init/main.c	2008-04-10 13:11:06.000000000 +1000
+++ linux-work/init/main.c	2008-04-10 13:11:19.000000000 +1000
@@ -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();
Index: linux-work/include/linux/sched.h
===================================================================
--- linux-work.orig/include/linux/sched.h	2008-04-10 13:11:44.000000000 +1000
+++ linux-work/include/linux/sched.h	2008-04-10 13:12:05.000000000 +1000
@@ -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
  */

^ permalink raw reply	[flat|nested] 32+ messages in thread
* [PATCH 1/2] Add thread_info_cache_init() to all archs
@ 2008-04-10 23:36 Benjamin Herrenschmidt
  2008-04-10 23:36 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 32+ messages in thread
From: Benjamin Herrenschmidt @ 2008-04-10 23:36 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Paul Mackerras, linuxppc-dev-mnsaURCQ41sdnm+yROfE0A,
	takata-TMSiXQfHlQjsTix1lMzHGQ,
	linux-m32r-rQhvJZKUsGBRYuoOT4C5/9i2O/JbrIOy, Linux-Arch

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.

Signed-off-by: Benjamin Herrenschmidt <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
---

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(+)

--- linux-work.orig/init/main.c	2008-04-10 13:11:06.000000000 +1000
+++ linux-work/init/main.c	2008-04-10 13:11:19.000000000 +1000
@@ -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();
Index: linux-work/include/linux/sched.h
===================================================================
--- linux-work.orig/include/linux/sched.h	2008-04-10 13:11:44.000000000 +1000
+++ linux-work/include/linux/sched.h	2008-04-11 09:35:58.000000000 +1000
@@ -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
  */

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2008-05-21 21:00 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-10  3:22 [PATCH 1/2] Add thread_info_cache_init() to all archs Benjamin Herrenschmidt
2008-04-10  3:22 ` Benjamin Herrenschmidt
     [not found] ` <20080410032354.90CB1DDF0F-mnsaURCQ41sdnm+yROfE0A@public.gmane.org>
2008-04-10 21:46   ` Benjamin Herrenschmidt
2008-04-10 21:46     ` Benjamin Herrenschmidt
2008-04-14  0:19   ` Andrew Morton
2008-04-14  0:19     ` Andrew Morton
2008-04-14  0:38     ` Benjamin Herrenschmidt
2008-04-14  0:38       ` Benjamin Herrenschmidt
2008-04-14  2:13       ` Andrew Morton
2008-04-14  2:13         ` Andrew Morton
     [not found]         ` <20080413191338.9776ebd0.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2008-04-18  3:58           ` Benjamin Herrenschmidt
2008-04-18  3:58             ` Benjamin Herrenschmidt
2008-04-18  4:19             ` Andrew Morton
2008-04-18  4:19               ` Andrew Morton
     [not found]               ` <20080417211905.8ff769fa.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2008-04-18  4:38                 ` Michael Ellerman
2008-04-18  4:38                   ` Michael Ellerman
2008-04-18  6:44                 ` Benjamin Herrenschmidt
2008-04-18  6:44                   ` Benjamin Herrenschmidt
2008-05-21 17:56                   ` Benjamin Herrenschmidt
2008-05-21 17:56                     ` Benjamin Herrenschmidt
2008-05-21 18:41                     ` Andrew Morton
2008-05-21 18:41                       ` Andrew Morton
2008-05-21 19:06                       ` Sam Ravnborg
2008-05-21 20:38                         ` Benjamin Herrenschmidt
2008-05-21 20:38                           ` Benjamin Herrenschmidt
2008-05-21 19:44                       ` Benjamin Herrenschmidt
2008-05-21 19:44                         ` Benjamin Herrenschmidt
2008-05-21 20:52                         ` Andrew Morton
2008-04-18  4:21             ` Kyle McMartin
2008-04-18  4:21               ` Kyle McMartin
  -- strict thread matches above, loose matches on Subject: below --
2008-04-10 23:36 Benjamin Herrenschmidt
2008-04-10 23:36 ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox