Re: [patch 1/2] x86, fpu: split FPU state from task struct - v3

Suresh Siddha
2008-03-04T01:37:05Z

On Mon, Mar 03, 2008 at 08:18:49PM -0500, Christoph Hellwig wrote:
> On Mon, Mar 03, 2008 at 03:02:45PM -0800, Suresh Siddha wrote:
> > +void __attribute__((weak)) arch_task_cache_init(void)
> > +{
> > +}
> > +
> > void __init fork_init(unsigned long mempages)
> > {
> > #ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
> > @@ -144,6 +148,9 @@
> > ARCH_MIN_TASKALIGN, SLAB_PANIC | SLAB_NOTRACK, NULL);
> > #endif
> >
> > + /* do the arch specific task caches init */
> > + arch_task_cache_init();
>
> Why can't this just be a normal initcall (with the right level)?

This is sort of an extension to the per-task area. And this needs to be done
before any task starts using this state. Thought this is the nice place to
initialize the extension caches along with the main task_struct init.

>
> > +int __attribute__((weak)) arch_dup_task_struct(struct task_struct *dst,
> > + struct task_struct *src)
> > +{
> > + *dst = *src;
> > + return 0;
> > +}
> > +
> > static struct task_struct *dup_task_struct(struct task_struct *orig)
> > {
> > struct task_struct *tsk;
> > @@ -181,15 +195,15 @@
> > return NULL;
> > }
> >
> > - *tsk = *orig;
> > + err = arch_dup_task_struct(tsk, orig);
> > + if (err)
> > + goto out;
> > +
>
> You're still adding a second hook instead of re-using or re-naming
> setup_thread_stack. Did I miss a good explanation for that
> or was this just an oversight?

Not an oversight. setup_thread_stack comes with its own baggage called
__HAVE_THREAD_FUNCTIONS. Thought of keeping this simple and separate
by using an inline or weak linkage.

> Also this weak linkage stuff creaping in is really ugly.

hmm.. any better suggestion?

thanks,
suresh