hppa: heartbeat: timeout_add(9) -> timeout_add_usec(9)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

hppa: heartbeat: timeout_add(9) -> timeout_add_usec(9)

Scott Cheloha
1/16 seconds is exactly 62500 microseconds.

ok?

Index: arch/hppa/hppa/autoconf.c
===================================================================
RCS file: /cvs/src/sys/arch/hppa/hppa/autoconf.c,v
retrieving revision 1.62
diff -u -p -r1.62 autoconf.c
--- arch/hppa/hppa/autoconf.c 27 Jan 2018 22:55:23 -0000 1.62
+++ arch/hppa/hppa/autoconf.c 23 Dec 2019 19:21:32 -0000
@@ -110,7 +110,7 @@ heartbeat(v)
  int toggle, cp_mask, cp_total, cp_idle;
  struct schedstate_percpu *spc = &(curcpu()->ci_schedstate);
 
- timeout_add(&heartbeat_tmo, hz / 16);
+ timeout_add_usec(&heartbeat_tmo, 62500); /* 1/16 seconds */
 
  cp_idle = spc->spc_cp_time[CP_IDLE];
  cp_total = spc->spc_cp_time[CP_USER] + spc->spc_cp_time[CP_NICE] +

Reply | Threaded
Open this post in threaded view
|

Re: hppa: heartbeat: timeout_add(9) -> timeout_add_usec(9)

Scott Cheloha
On Mon, Dec 23, 2019 at 01:23:28PM -0600, Scott Cheloha wrote:
> 1/16 seconds is exactly 62500 microseconds.
>
> ok?

1mo bump.

> Index: arch/hppa/hppa/autoconf.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/hppa/hppa/autoconf.c,v
> retrieving revision 1.62
> diff -u -p -r1.62 autoconf.c
> --- arch/hppa/hppa/autoconf.c 27 Jan 2018 22:55:23 -0000 1.62
> +++ arch/hppa/hppa/autoconf.c 23 Dec 2019 19:21:32 -0000
> @@ -110,7 +110,7 @@ heartbeat(v)
>   int toggle, cp_mask, cp_total, cp_idle;
>   struct schedstate_percpu *spc = &(curcpu()->ci_schedstate);
>  
> - timeout_add(&heartbeat_tmo, hz / 16);
> + timeout_add_usec(&heartbeat_tmo, 62500); /* 1/16 seconds */
>  
>   cp_idle = spc->spc_cp_time[CP_IDLE];
>   cp_total = spc->spc_cp_time[CP_USER] + spc->spc_cp_time[CP_NICE] +

Reply | Threaded
Open this post in threaded view
|

Re: hppa: heartbeat: timeout_add(9) -> timeout_add_usec(9)

Scott Cheloha
On Tue, Jan 21, 2020 at 08:06:14PM -0600, Scott Cheloha wrote:
> On Mon, Dec 23, 2019 at 01:23:28PM -0600, Scott Cheloha wrote:
> > 1/16 seconds is exactly 62500 microseconds.
> >
> > ok?
>
> 1mo bump.

3 month bump.

After pondering this for many months I've decided using SEC_TO_NSEC(9)
is better than adding a comment explaining what the fraction is
supposed to be.

Anyone ok?

Index: hppa/autoconf.c
===================================================================
RCS file: /cvs/src/sys/arch/hppa/hppa/autoconf.c,v
retrieving revision 1.62
diff -u -p -r1.62 autoconf.c
--- hppa/autoconf.c 27 Jan 2018 22:55:23 -0000 1.62
+++ hppa/autoconf.c 16 Mar 2020 01:12:52 -0000
@@ -50,6 +50,7 @@
 #include <sys/conf.h>
 #include <sys/reboot.h>
 #include <sys/device.h>
+#include <sys/time.h>
 #include <sys/timeout.h>
 
 #include <uvm/uvm_extern.h>
@@ -110,7 +111,7 @@ heartbeat(v)
  int toggle, cp_mask, cp_total, cp_idle;
  struct schedstate_percpu *spc = &(curcpu()->ci_schedstate);
 
- timeout_add(&heartbeat_tmo, hz / 16);
+ timeout_add_nsec(&heartbeat_tmo, SEC_TO_NSEC(1) / 16);
 
  cp_idle = spc->spc_cp_time[CP_IDLE];
  cp_total = spc->spc_cp_time[CP_USER] + spc->spc_cp_time[CP_NICE] +