Re: [patch 05/11] syslets: core code

From: Guillaume Chazarain
Date: Wed Feb 14 2007 - 07:43:38 EST


Ingo Molnar a Ãcrit :
+ if (unlikely(signal_pending(t) || need_resched()))
+ goto stop;

So, this is how you'll prevent me from running an infinite loop ;-)
The attached patch adds a cond_resched() instead, to allow infinite
loops without DoS. I dropped the unlikely() as it's already in the
definition of signal_pending().

+asmlinkage long sys_async_wait(unsigned long min_wait_events)

Here I would expect:

sys_async_wait_for_all(struct syslet_atom *atoms, long nr_atoms)

and

sys_async_wait_for_any(struct syslet_atom *atoms, long nr_atoms).

This way syslets can be used by different parts of a program without
having them waiting for each other.

Thanks.

--
Guillaume

--- linux-2.6/kernel/async.c
+++ linux-2.6/kernel/async.c
@@ -433,9 +433,10 @@

last_uatom = uatom;
ret = __exec_atom(t, &atom);
- if (unlikely(signal_pending(t) || need_resched()))
+ if (signal_pending(t))
goto stop;

+ cond_resched();
uatom = next_uatom(&atom, uatom, ret);
if (uatom)
goto run_next;