mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: mingo@elte.hu, hpa@zytor.com, tglx@linutronix.de,
	andi@firstfloor.org, linux-kernel@vger.kernel.org,
	Arjan van de Ven <arjan@linux.intel.com>
Subject: Re: [patch 2/2] x86,fpu: lazy allocation of FPU area
Date: Sat, 23 Feb 2008 22:08:52 -0500	[thread overview]
Message-ID: <20080224030852.GB7282@infradead.org> (raw)
In-Reply-To: <20080224023547.412501000@linux-os.sc.intel.com>

On Sat, Feb 23, 2008 at 06:34:39PM -0800, Suresh Siddha wrote:
> +	if (!tsk->thread.cntxt)
> +                tsk->thread.cntxt = alloc_cntxt_struct();

Please use tabs, not spaces for indentation.

> +union thread_cntxt *alloc_cntxt_struct(void)
> +{
> +	return kmem_cache_alloc(task_cntxt_cachep, GFP_KERNEL);
> +}

Why do you need this wrapper at all?

> +struct task_struct * alloc_task_struct(struct task_struct *src)
>  {
>  	struct task_struct *tsk;
>  	tsk = kmem_cache_alloc(task_struct_cachep, GFP_KERNEL);
> +	if (tsk && src->thread.cntxt) {
> +		tsk->thread.cntxt = alloc_cntxt_struct();
> +		if (!tsk->thread.cntxt) {
> +			kmem_cache_free(task_struct_cachep, tsk);
> +			return NULL;
> +		}
> +		WARN_ON((unsigned long)tsk->thread.cntxt & 15);
> +	} else if (tsk)
> +		tsk->thread.cntxt = NULL;
>  	return tsk;

I think passing the src here doesn't make much sense.  Copying
the fpu context structure should be done by the arch dup_task_struct
hook.  Now if you free the fpu context in free_thread_info that means
you don't have to have your own arch-specific task_struct allocator
which would be a _lot_ cleaner.  Talking about clean I think
the .cntxt field really wants a more descriptive name :)


  reply	other threads:[~2008-02-24  3:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-24  2:34 [patch 1/2] x86,fpu: split FPU state from task struct Suresh Siddha
2008-02-24  2:34 ` [patch 2/2] x86,fpu: lazy allocation of FPU area Suresh Siddha
2008-02-24  3:08   ` Christoph Hellwig [this message]
2008-02-24 12:20   ` Andi Kleen
2008-02-24 16:32     ` Siddha, Suresh B
2008-02-24  3:04 ` [patch 1/2] x86,fpu: split FPU state from task struct Christoph Hellwig
2008-02-24  7:22 ` Ingo Molnar
2008-02-24 16:30   ` Siddha, Suresh B

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080224030852.GB7282@infradead.org \
    --to=hch@infradead.org \
    --cc=andi@firstfloor.org \
    --cc=arjan@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome