Skip to content

Commit

Permalink
xen: use time_is_before_eq_jiffies() instead of open coding it
Browse files Browse the repository at this point in the history
Use the helper function time_is_{before,after}_jiffies() to improve
code readability.

Signed-off-by: Wang Qing <wangqing@vivo.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Link: https://lore.kernel.org/r/1646018104-61415-1-git-send-email-wangqing@vivo.com
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
  • Loading branch information
Wang Qing authored and Boris Ostrovsky committed Mar 10, 2022
1 parent 1db333d commit b537bf4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/xen/balloon.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include <linux/slab.h>
#include <linux/sysctl.h>
#include <linux/moduleparam.h>
#include <linux/jiffies.h>

#include <asm/page.h>
#include <asm/tlb.h>
Expand Down Expand Up @@ -794,7 +795,7 @@ static int __init balloon_wait_finish(void)
if (balloon_state == BP_ECANCELED) {
pr_warn_once("Initial ballooning failed, %ld pages need to be freed.\n",
-credit);
if (jiffies - last_changed >= HZ * balloon_boot_timeout)
if (time_is_before_eq_jiffies(last_changed + HZ * balloon_boot_timeout))
panic("Initial ballooning failed!\n");
}

Expand Down

0 comments on commit b537bf4

Please sign in to comment.