diff mbox

[v2,1/2] linux-generic: odp_schedule: fix odp_schdule_wait_time

Message ID 1441901930-29287-2-git-send-email-ivan.khoronzhuk@linaro.org
State Accepted
Commit 30cd1e2292dfe034491cc32b30bbb6ffe5ff558a
Headers show

Commit Message

Ivan Khoronzhuk Sept. 10, 2015, 4:18 p.m. UTC
Depending on resolution, a low nsec value could be converted to 0
cycles, wich was specified as ODP_SCHED_WAIT and would instruct a
schedule call to wait forever.

Also ODP_SCHED_NO_WAIT corresponds to 1 tick, it's rarely but can
wait a little, when shced time has slower rate. It should correspond
to schedule only once.

So, change ODP_SCHED_NO_WAIT to 0 and ODP_SCHED_NO_WAIT to UINT64_MAX.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 platform/linux-generic/include/odp/plat/schedule_types.h | 4 ++--
 platform/linux-generic/odp_schedule.c                    | 3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

Comments

Savolainen, Petri (Nokia - FI/Espoo) Sept. 11, 2015, 7:53 a.m. UTC | #1
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>

> -----Original Message-----
> From: EXT Ivan Khoronzhuk [mailto:ivan.khoronzhuk@linaro.org]
> Sent: Thursday, September 10, 2015 7:19 PM
> To: lng-odp@lists.linaro.org; Savolainen, Petri (Nokia - FI/Espoo);
> nmorey@kalray.eu
> Cc: Ivan Khoronzhuk
> Subject: [lng-odp] [PATCH v2 1/2] linux-generic: odp_schedule: fix
> odp_schdule_wait_time
> 
> Depending on resolution, a low nsec value could be converted to 0
> cycles, wich was specified as ODP_SCHED_WAIT and would instruct a
> schedule call to wait forever.
> 
> Also ODP_SCHED_NO_WAIT corresponds to 1 tick, it's rarely but can
> wait a little, when shced time has slower rate. It should correspond
> to schedule only once.
> 
> So, change ODP_SCHED_NO_WAIT to 0 and ODP_SCHED_NO_WAIT to UINT64_MAX.
> 
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
> ---
>  platform/linux-generic/include/odp/plat/schedule_types.h | 4 ++--
>  platform/linux-generic/odp_schedule.c                    | 3 ---
>  2 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/platform/linux-generic/include/odp/plat/schedule_types.h
> b/platform/linux-generic/include/odp/plat/schedule_types.h
> index c48b652..8cdc40b 100644
> --- a/platform/linux-generic/include/odp/plat/schedule_types.h
> +++ b/platform/linux-generic/include/odp/plat/schedule_types.h
> @@ -22,8 +22,8 @@ extern "C" {
>   *  @{
>   */
> 
> -#define ODP_SCHED_WAIT     0
> -#define ODP_SCHED_NO_WAIT  1
> +#define ODP_SCHED_WAIT     UINT64_MAX
> +#define ODP_SCHED_NO_WAIT  0
> 
>  typedef int odp_schedule_prio_t;
> 
> diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-
> generic/odp_schedule.c
> index c6619e5..827fcf0 100644
> --- a/platform/linux-generic/odp_schedule.c
> +++ b/platform/linux-generic/odp_schedule.c
> @@ -646,9 +646,6 @@ void odp_schedule_resume(void)
> 
>  uint64_t odp_schedule_wait_time(uint64_t ns)
>  {
> -	if (ns <= ODP_SCHED_NO_WAIT)
> -		ns = ODP_SCHED_NO_WAIT + 1;
> -
>  	return odp_time_ns_to_cycles(ns);
>  }
> 
> --
> 1.9.1
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp/plat/schedule_types.h b/platform/linux-generic/include/odp/plat/schedule_types.h
index c48b652..8cdc40b 100644
--- a/platform/linux-generic/include/odp/plat/schedule_types.h
+++ b/platform/linux-generic/include/odp/plat/schedule_types.h
@@ -22,8 +22,8 @@  extern "C" {
  *  @{
  */
 
-#define ODP_SCHED_WAIT     0
-#define ODP_SCHED_NO_WAIT  1
+#define ODP_SCHED_WAIT     UINT64_MAX
+#define ODP_SCHED_NO_WAIT  0
 
 typedef int odp_schedule_prio_t;
 
diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c
index c6619e5..827fcf0 100644
--- a/platform/linux-generic/odp_schedule.c
+++ b/platform/linux-generic/odp_schedule.c
@@ -646,9 +646,6 @@  void odp_schedule_resume(void)
 
 uint64_t odp_schedule_wait_time(uint64_t ns)
 {
-	if (ns <= ODP_SCHED_NO_WAIT)
-		ns = ODP_SCHED_NO_WAIT + 1;
-
 	return odp_time_ns_to_cycles(ns);
 }