[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0702231504370.31281@alien.or.mcafeemobile.com>
Date:	Fri, 23 Feb 2007 15:08:55 -0800 (PST)
From:	Davide Libenzi <davidel@...ilserver.org>
To:	Ingo Molnar <mingo@...e.hu>
cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Arjan van de Ven <arjan@...radead.org>,
	Christoph Hellwig <hch@...radead.org>,
	Andrew Morton <akpm@....com.au>,
	Alan Cox <alan@...rguk.ukuu.org.uk>,
	Ulrich Drepper <drepper@...hat.com>,
	Zach Brown <zach.brown@...cle.com>,
	Evgeniy Polyakov <johnpol@....mipt.ru>,
	"David S. Miller" <davem@...emloft.net>,
	Suparna Bhattacharya <suparna@...ibm.com>,
	Jens Axboe <jens.axboe@...cle.com>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [patch 04/13] syslets: core code
On Wed, 21 Feb 2007, Ingo Molnar wrote:
> +asmlinkage long
> +sys_threadlet_on(unsigned long restore_stack,
> +		 unsigned long restore_eip,
> +		 struct async_head_user __user *ahu)
> +{
> +	struct task_struct *t = current;
> +	struct async_head *ah = t->ah;
> +	struct async_thread *at = &t->__at;
> +	long ret;
> +
> +	/*
> +	 * Do not allow recursive calls of sys_threadlet_on():
> +	 */
> +	if (t->async_ready || t->at)
> +		return -EINVAL;
> +
> +	if (unlikely(!ah)) {
> +		ret = init_head(ah, t, ahu);
> +		if (ret)
> +			return ret;
> +		ah = t->ah;
> +	}
> +
> +	if (unlikely(list_empty(&ah->ready_async_threads))) {
> +		ret = refill_cachemiss_pool(ah, t, ahu);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	t->async_ready = at;
> +	ah->restore_stack = restore_stack;
> +	ah->restore_eip = restore_eip;
> +
> +	ah->ahu = ahu;
> +
> +	return 0;
> +}
> +
> +asmlinkage long sys_threadlet_off(void)
> +{
> +	struct task_struct *t = current;
> +	struct async_head *ah = t->ah;
> +
> +	/*
> +	 * Are we still executing as head?
> +	 */
> +	if (ah) {
> +		t->async_ready = NULL;
> +
> +		return 1;
> +	}
> +
> +	/*
> +	 * We got turned into a cachemiss thread,
> +	 * return to user-space, which can do
> +	 * the notification, etc:
> +	 */
> +	return 0;
> +}
If we have a new syscall that does the exec, we can save the two on/off 
calls. Also, the complete_thread() thingy can be done automatically from 
inside the kernel upon function return, by hence making the threadlet 
function look like a normal thread function:
long thfn(void *) {
	...
	return error;
}
No?
- Davide
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists
 
