[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] xen: use time_is_before_eq_jiffies() instead of open coding it


  • To: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
  • From: Qing Wang <wangqing@xxxxxxxx>
  • Date: Sun, 27 Feb 2022 19:15:03 -0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=v8krF1cSsCFYuWdZnXErYBDMuwe0kPjprcu+E4vYgxk=; b=T8swgeEfOCQlPLxu+xYDfSqF0DkXbdkyCk8jKWsNT8aJi7kB08PAnULHxO0nkL74SZ+WhVQ4s6YNa6ll3ogfZSmVZtyUd97HYgiR6TnpupirkYrjAWykas0LXaY+Dr4+F1V2i2dDWNiwvlt5iDayPpEOaUf366TmmFLp+af1/L48JypErtl2Uov/6Qdq/cXyI+vATU/COav7CHY7TpJAOsQuNp7LLgyVr0SWhwxiT7KAB9ZGaFeae4ebVcufje0kRh+ygPSIcWvr83OYJIOBogY8ReJXBa/NXhUxE94Uuko5XFfVyeWilW9K5KMi9/67uDDp4+5mYQIVCTrgvI8i2A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n1fEWfHCHkAUJpDNFUgKGKSfUYPuyoiT3QrP6ueVail+mA/KRZ/XunmYzqsvAIT+Dph4Bg3gMteyIOXc6tNCnQJCqnjByWvZx237XKYxYmPvvXMNaon4nx25k5zZvpNWPJA6nlILXvnZssSjVbiImVY67a3HHRYVLMZPmrdbDjoYBR0JVFag9jXjJPf1jjvib2T+/osRn1I5W04skS2HXf7jrFCnJHkW7Olksrnoc1iEUIyZjpVySFKi2CWKj0aB4uGlTk6IGI0tFS/Qg9Uy81lap62nUqKErWSpS0l5+BSDmWez45Pd1zvtuogW8KdgXxQ5UDOiYwLlvyeCNAXyQQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com;
  • Cc: Wang Qing <wangqing@xxxxxxxx>
  • Delivery-date: Mon, 28 Feb 2022 03:15:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Wang Qing <wangqing@xxxxxxxx>

Use the helper function time_is_{before,after}_jiffies() to improve
code readability.

Signed-off-by: Wang Qing <wangqing@xxxxxxxx>
---
 drivers/xen/balloon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index a2c4fc49..dfe26fa
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -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>
@@ -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");
                }
 
-- 
2.7.4




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.