LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v3] Add time_is_after_jiffies and others which compare with jiffies
@ 2008-03-10  1:22 Dave Young
  2008-03-11  3:17 ` KOSAKI Motohiro
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Young @ 2008-03-10  1:22 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, hannes, alan

Most of time_after like macros usages just compare jiffies and
another number, so here add some time_is_* macros for convenience.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>

---
include/linux/jiffies.h |   16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff -upr linux/include/linux/jiffies.h linux.new/include/linux/jiffies.h
--- linux/include/linux/jiffies.h	2008-03-07 10:40:04.000000000 +0800
+++ linux.new/include/linux/jiffies.h	2008-03-10 09:11:36.000000000 +0800
@@ -135,6 +135,22 @@ static inline u64 get_jiffies_64(void)
 #define time_before_eq64(a,b)	time_after_eq64(b,a)
 
 /*
+ * These four macros compare jiffies and 'a' for convenience.
+ */
+
+/* time_is_before_jiffies(a) return true if a is before jiffies */
+#define time_is_before_jiffies(a) time_after(jiffies, a)
+
+/* time_is_after_jiffies(a) return true if a is after jiffies */
+#define time_is_after_jiffies(a) time_before(jiffies, a)
+
+/* time_is_before_eq_jiffies(a) return true if a is before or equal to jiffies*/
+#define time_is_before_eq_jiffies(a) time_after_eq(jiffies, a)
+
+/* time_is_after_eq_jiffies(a) return true if a is after or equal to jiffies*/
+#define time_is_after_eq_jiffies(a) time_before_eq(jiffies, a)
+
+/*
  * Have the 32 bit jiffies value wrap 5 minutes after boot
  * so jiffies wrap bugs show up earlier.
  */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] Add time_is_after_jiffies and others which compare with jiffies
  2008-03-10  1:22 [PATCH v3] Add time_is_after_jiffies and others which compare with jiffies Dave Young
@ 2008-03-11  3:17 ` KOSAKI Motohiro
  2008-03-11  4:51   ` Dave Young
  0 siblings, 1 reply; 3+ messages in thread
From: KOSAKI Motohiro @ 2008-03-11  3:17 UTC (permalink / raw)
  To: Dave Young; +Cc: kosaki.motohiro, akpm, linux-kernel, hannes, alan

Hi

Why don't you make jiffies_64 stuff?



> Most of time_after like macros usages just compare jiffies and
> another number, so here add some time_is_* macros for convenience.
> 
> Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
> 
> ---
> include/linux/jiffies.h |   16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
> 
> diff -upr linux/include/linux/jiffies.h linux.new/include/linux/jiffies.h
> --- linux/include/linux/jiffies.h	2008-03-07 10:40:04.000000000 +0800
> +++ linux.new/include/linux/jiffies.h	2008-03-10 09:11:36.000000000 +0800
> @@ -135,6 +135,22 @@ static inline u64 get_jiffies_64(void)
>  #define time_before_eq64(a,b)	time_after_eq64(b,a)
>  
>  /*
> + * These four macros compare jiffies and 'a' for convenience.
> + */
> +
> +/* time_is_before_jiffies(a) return true if a is before jiffies */
> +#define time_is_before_jiffies(a) time_after(jiffies, a)
> +
> +/* time_is_after_jiffies(a) return true if a is after jiffies */
> +#define time_is_after_jiffies(a) time_before(jiffies, a)
> +
> +/* time_is_before_eq_jiffies(a) return true if a is before or equal to jiffies*/
> +#define time_is_before_eq_jiffies(a) time_after_eq(jiffies, a)
> +
> +/* time_is_after_eq_jiffies(a) return true if a is after or equal to jiffies*/
> +#define time_is_after_eq_jiffies(a) time_before_eq(jiffies, a)
> +
> +/*
>   * Have the 32 bit jiffies value wrap 5 minutes after boot
>   * so jiffies wrap bugs show up earlier.
>   */
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] Add time_is_after_jiffies and others which compare with jiffies
  2008-03-11  3:17 ` KOSAKI Motohiro
@ 2008-03-11  4:51   ` Dave Young
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Young @ 2008-03-11  4:51 UTC (permalink / raw)
  To: KOSAKI Motohiro; +Cc: akpm, linux-kernel, hannes, alan

On Tue, Mar 11, 2008 at 11:17 AM, KOSAKI Motohiro
<kosaki.motohiro@jp.fujitsu.com> wrote:
> Hi
>
>  Why don't you make jiffies_64 stuff?

Actually, I greped the kernel source, and found none of time_*64 usage.

After grep again, I found a missed one in:
arch/x86/kernel/cpu/mcheck/therm_throt.c

        if (time_before64(tmp_jiffs, __get_cpu_var(next_check)))
                return 0;

Does it really need time_before64 here?

If it does need then I wonder whether the other 64 macros may be
removed, or just to add a time_is_before64_jiffies

>
>
>
>
>
>  > Most of time_after like macros usages just compare jiffies and
>  > another number, so here add some time_is_* macros for convenience.
>  >
>  > Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
>  >
>  > ---
>  > include/linux/jiffies.h |   16 ++++++++++++++++
>  > 1 file changed, 16 insertions(+)
>  >
>  > diff -upr linux/include/linux/jiffies.h linux.new/include/linux/jiffies.h
>  > --- linux/include/linux/jiffies.h     2008-03-07 10:40:04.000000000 +0800
>  > +++ linux.new/include/linux/jiffies.h 2008-03-10 09:11:36.000000000 +0800
>  > @@ -135,6 +135,22 @@ static inline u64 get_jiffies_64(void)
>  >  #define time_before_eq64(a,b)        time_after_eq64(b,a)
>  >
>  >  /*
>  > + * These four macros compare jiffies and 'a' for convenience.
>  > + */
>  > +
>  > +/* time_is_before_jiffies(a) return true if a is before jiffies */
>  > +#define time_is_before_jiffies(a) time_after(jiffies, a)
>  > +
>  > +/* time_is_after_jiffies(a) return true if a is after jiffies */
>  > +#define time_is_after_jiffies(a) time_before(jiffies, a)
>  > +
>  > +/* time_is_before_eq_jiffies(a) return true if a is before or equal to jiffies*/
>  > +#define time_is_before_eq_jiffies(a) time_after_eq(jiffies, a)
>  > +
>  > +/* time_is_after_eq_jiffies(a) return true if a is after or equal to jiffies*/
>  > +#define time_is_after_eq_jiffies(a) time_before_eq(jiffies, a)
>  > +
>  > +/*
>  >   * Have the 32 bit jiffies value wrap 5 minutes after boot
>  >   * so jiffies wrap bugs show up earlier.
>  >   */
>  > --
>  > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>  > the body of a message to majordomo@vger.kernel.org
>  > More majordomo info at  http://vger.kernel.org/majordomo-info.html
>  > Please read the FAQ at  http://www.tux.org/lkml/
>
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-11  4:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-10  1:22 [PATCH v3] Add time_is_after_jiffies and others which compare with jiffies Dave Young
2008-03-11  3:17 ` KOSAKI Motohiro
2008-03-11  4:51   ` Dave Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).