Messages in this thread | | | Date | Fri, 23 Feb 2007 15:08:55 -0800 (PST) | From | Davide Libenzi <> | 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |