These tests are admittedly artificial, but do we really want to encourage this style of programming? Threads are cheap so the notion that a thread would be in a scheduler loop and then decide to stop doing that and go off and do something else seems strange. Effectively isn't this trying to mix control and data plane sort of logic in the same thread? Worker threads should simply do work and not worry about doing anything else. In that case the question of whether the implementation is or is not using some sort of local scheduler cache is transparent. It's the same as with buffer pools. The fact that a local buffer cache may or may not be used by the implementation doesn't "bleed through" the ODP APIs. I'd think the ODP scheduling APIs would be cleaner and more portable if the same applied there.
Threads/processes can terminate for any number of reasons, and a robust system needs to take that into account. In the case of buffer caches, for example, if a thread terminates then any locally cached buffers need to be flushed back to the pool from which they came. That's why there are hooks in odp_term_local() to do that. The scheduler should be no different. If a thread calls odp_term_local() then any "cached" scheduler items should similarly be rescheduled elsewhere without the application needing to be explicitly aware that this happened. On Mon, Dec 22, 2014 at 7:10 AM, Savolainen, Petri (NSN - FI/Espoo) < [email protected]> wrote: > > > > Because the thread will exit the schedule loop, it has to pause first and > then run sched loop until the potential per thread local scheduler cache is > empty (see under). > > > > -Petri > > > > int done = 0; > > > > while (1) { > > odp_timeout_t tmo; > > > > if (done) > > buf = odp_schedule(&queue, ODP_SCHED_NO_WAIT); > > else > > buf = odp_schedule(&queue, > ODP_SCHED_WAIT); > > > > if (buf == ODP_BUFFER_INVALID) > > break; > > > > tmo = odp_timeout_from_buffer(buf); > > tick = odp_timeout_tick(tmo); > > > > EXAMPLE_DBG(" [%i] timeout, tick > %"PRIu64"\n", thr, tick); > > > > odp_buffer_free(buf); > > > > num--; > > > > if (num == 0) { > > odp_schedule_pause(); > > done = 1; > > continue; > > } > > > > tick += period; > > > > odp_timer_absolute_tmo(test_timer, tick, > > queue, > ODP_BUFFER_INVALID); > > } > > > > > > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *ext Bill Fischofer > *Sent:* Friday, December 19, 2014 10:38 PM > *To:* Mike Holmes > *Cc:* lng-odp-forward > *Subject:* Re: [lng-odp] [PATCH v2 2/3] example: odp_timer_test: remove > use of odp_schdule_one > > > > Typo in the title (odp_schdule_one). Presumably Maxim can fix during > merge? > > > > On Fri, Dec 19, 2014 at 2:34 PM, Mike Holmes <[email protected]> > wrote: > > Signed-off-by: Mike Holmes <[email protected]> > --- > example/timer/odp_timer_test.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/example/timer/odp_timer_test.c > b/example/timer/odp_timer_test.c > index 0d6e31a..6d2609a 100644 > --- a/example/timer/odp_timer_test.c > +++ b/example/timer/odp_timer_test.c > @@ -84,7 +84,7 @@ static void test_abs_timeouts(int thr, test_args_t *args) > while (1) { > odp_timeout_t tmo; > > - buf = odp_schedule_one(&queue, ODP_SCHED_WAIT); > + buf = odp_schedule(&queue, ODP_SCHED_WAIT); > > tmo = odp_timeout_from_buffer(buf); > tick = odp_timeout_tick(tmo); > -- > 2.1.0 > > > _______________________________________________ > lng-odp mailing list > [email protected] > http://lists.linaro.org/mailman/listinfo/lng-odp >
_______________________________________________ lng-odp mailing list [email protected] http://lists.linaro.org/mailman/listinfo/lng-odp
