From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932246AbbIUKSk (ORCPT ); Mon, 21 Sep 2015 06:18:40 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:33959 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932216AbbIUKSh (ORCPT ); Mon, 21 Sep 2015 06:18:37 -0400 From: Sudip Mukherjee To: Greg Kroah-Hartman , Arnd Bergmann , Dimitri Sivanich Cc: linux-kernel@vger.kernel.org, Sudip Mukherjee Subject: [PATCH 1/3] sgi-gru: use time_before() Date: Mon, 21 Sep 2015 15:48:17 +0530 Message-Id: <1442830699-20562-2-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442830699-20562-1-git-send-email-sudipm.mukherjee@gmail.com> References: <1442830699-20562-1-git-send-email-sudipm.mukherjee@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Manuel Schölling To be future-proof and for better readability the time comparisons are modified to use time_before() instead of plain, error-prone math. Signed-off-by: Manuel Schölling Acked-by: Dimitri Sivanich Signed-off-by: Sudip Mukherjee --- reference at: https://patchwork.kernel.org/patch/4270701/ drivers/misc/sgi-gru/grumain.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c index ae16c8c..1525870 100644 --- a/drivers/misc/sgi-gru/grumain.c +++ b/drivers/misc/sgi-gru/grumain.c @@ -930,6 +930,7 @@ int gru_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct gru_thread_state *gts; unsigned long paddr, vaddr; + unsigned long expires; vaddr = (unsigned long)vmf->virtual_address; gru_dbg(grudev, "vma %p, vaddr 0x%lx (0x%lx)\n", @@ -954,7 +955,8 @@ again: mutex_unlock(>s->ts_ctxlock); set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(GRU_ASSIGN_DELAY); /* true hack ZZZ */ - if (gts->ts_steal_jiffies + GRU_STEAL_DELAY < jiffies) + expires = gts->ts_steal_jiffies + GRU_STEAL_DELAY; + if (time_before(expires, jiffies)) gru_steal_context(gts); goto again; } -- 1.9.1