diff mbox

[v9,04/10] jiffies: Introduce USER_TICK_USEC and redefine TICK_USEC

Message ID 7620417.mBP1cQHt5D@aspire.rjw.lan (mailing list archive)
State Mainlined
Delegated to: Rafael Wysocki
Headers show

Commit Message

Rafael J. Wysocki April 4, 2018, 8:38 a.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Since the subsequent changes will need a TICK_USEC definition
analogous to TICK_NSEC, rename the existing TICK_USEC as
USER_TICK_USEC, update its users and redefine TICK_USEC
accordingly.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

v8 -> v9: No changes.

---
 drivers/net/ethernet/sfc/mcdi.c |    2 +-
 include/linux/jiffies.h         |    7 +++++--
 kernel/time/ntp.c               |    2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

Comments

Frederic Weisbecker April 6, 2018, 1:09 a.m. UTC | #1
On Wed, Apr 04, 2018 at 10:38:34AM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Since the subsequent changes will need a TICK_USEC definition
> analogous to TICK_NSEC, rename the existing TICK_USEC as
> USER_TICK_USEC, update its users and redefine TICK_USEC
> accordingly.
> 
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> 
> v8 -> v9: No changes.
> 
> ---
>  drivers/net/ethernet/sfc/mcdi.c |    2 +-
>  include/linux/jiffies.h         |    7 +++++--
>  kernel/time/ntp.c               |    2 +-
>  3 files changed, 7 insertions(+), 4 deletions(-)
> 
> Index: linux-pm/include/linux/jiffies.h
> ===================================================================
> --- linux-pm.orig/include/linux/jiffies.h
> +++ linux-pm/include/linux/jiffies.h
> @@ -62,8 +62,11 @@ extern int register_refined_jiffies(long
>  /* TICK_NSEC is the time between ticks in nsec assuming SHIFTED_HZ */
>  #define TICK_NSEC ((NSEC_PER_SEC+HZ/2)/HZ)
>  
> -/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
> -#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
> +/* TICK_USEC is the time between ticks in usec assuming SHIFTED_HZ */
> +#define TICK_USEC ((USEC_PER_SEC + HZ/2) / HZ)

Nit: SHIFTED_HZ doesn't seem to exist anymore.

Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Rafael J. Wysocki April 6, 2018, 7:20 a.m. UTC | #2
On Friday, April 6, 2018 3:09:55 AM CEST Frederic Weisbecker wrote:
> On Wed, Apr 04, 2018 at 10:38:34AM +0200, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > 
> > Since the subsequent changes will need a TICK_USEC definition
> > analogous to TICK_NSEC, rename the existing TICK_USEC as
> > USER_TICK_USEC, update its users and redefine TICK_USEC
> > accordingly.
> > 
> > Suggested-by: Peter Zijlstra <peterz@infradead.org>
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> > 
> > v8 -> v9: No changes.
> > 
> > ---
> >  drivers/net/ethernet/sfc/mcdi.c |    2 +-
> >  include/linux/jiffies.h         |    7 +++++--
> >  kernel/time/ntp.c               |    2 +-
> >  3 files changed, 7 insertions(+), 4 deletions(-)
> > 
> > Index: linux-pm/include/linux/jiffies.h
> > ===================================================================
> > --- linux-pm.orig/include/linux/jiffies.h
> > +++ linux-pm/include/linux/jiffies.h
> > @@ -62,8 +62,11 @@ extern int register_refined_jiffies(long
> >  /* TICK_NSEC is the time between ticks in nsec assuming SHIFTED_HZ */
> >  #define TICK_NSEC ((NSEC_PER_SEC+HZ/2)/HZ)
> >  
> > -/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
> > -#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
> > +/* TICK_USEC is the time between ticks in usec assuming SHIFTED_HZ */
> > +#define TICK_USEC ((USEC_PER_SEC + HZ/2) / HZ)
> 
> Nit: SHIFTED_HZ doesn't seem to exist anymore.

Well, fair enough, but that would need to be changed along with the TICK_NSEC
comment IMO.

> Reviewed-by: Frederic Weisbecker <frederic@kernel.org>

Thanks!
diff mbox

Patch

Index: linux-pm/include/linux/jiffies.h
===================================================================
--- linux-pm.orig/include/linux/jiffies.h
+++ linux-pm/include/linux/jiffies.h
@@ -62,8 +62,11 @@  extern int register_refined_jiffies(long
 /* TICK_NSEC is the time between ticks in nsec assuming SHIFTED_HZ */
 #define TICK_NSEC ((NSEC_PER_SEC+HZ/2)/HZ)
 
-/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
-#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
+/* TICK_USEC is the time between ticks in usec assuming SHIFTED_HZ */
+#define TICK_USEC ((USEC_PER_SEC + HZ/2) / HZ)
+
+/* USER_TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
+#define USER_TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
 
 #ifndef __jiffy_arch_data
 #define __jiffy_arch_data
Index: linux-pm/drivers/net/ethernet/sfc/mcdi.c
===================================================================
--- linux-pm.orig/drivers/net/ethernet/sfc/mcdi.c
+++ linux-pm/drivers/net/ethernet/sfc/mcdi.c
@@ -375,7 +375,7 @@  static int efx_mcdi_poll(struct efx_nic
 	 * because generally mcdi responses are fast. After that, back off
 	 * and poll once a jiffy (approximately)
 	 */
-	spins = TICK_USEC;
+	spins = USER_TICK_USEC;
 	finish = jiffies + MCDI_RPC_TIMEOUT;
 
 	while (1) {
Index: linux-pm/kernel/time/ntp.c
===================================================================
--- linux-pm.orig/kernel/time/ntp.c
+++ linux-pm/kernel/time/ntp.c
@@ -31,7 +31,7 @@ 
 
 
 /* USER_HZ period (usecs): */
-unsigned long			tick_usec = TICK_USEC;
+unsigned long			tick_usec = USER_TICK_USEC;
 
 /* SHIFTED_HZ period (nsecs): */
 unsigned long			tick_nsec;