From patchwork Sun Mar 13 19:50:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 63774 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2134875lbc; Sun, 13 Mar 2016 12:51:12 -0700 (PDT) X-Received: by 10.98.7.81 with SMTP id b78mr14130209pfd.49.1457898672179; Sun, 13 Mar 2016 12:51:12 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9si10272653pfa.9.2016.03.13.12.51.11; Sun, 13 Mar 2016 12:51:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@cavium-com.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754160AbcCMTur (ORCPT + 30 others); Sun, 13 Mar 2016 15:50:47 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:34667 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751994AbcCMTu1 (ORCPT ); Sun, 13 Mar 2016 15:50:27 -0400 Received: by mail-pf0-f170.google.com with SMTP id x3so26836705pfb.1 for ; Sun, 13 Mar 2016 12:50:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cavium-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=93GuuJd9uEHUPDRXITSItYNyJC9/Yn3GZMio/8PBhsk=; b=RsNwnIyJ7oLUyp6yam2wTW8kX3MqRp1anSOwE1HxeUw3+d6ydvQgD18pAjvFiWJTsB 7AnVDwu6a3XjCz6c7I3JxViZ9zX/ka/VqgcUvbjJnyLwmLaHLKZTGpcdhP5CzXiWuT/K fSkV8vr+96qNDdJwzDTLZtoW5HxVlWymeJTS4Gx7kZUoNoMLCQ21WvvcsVyCw1wCiG8N D/OmRCVX3iiZ4hEc307q2n6tA4+YcLH9tBxQcj3B3JH2odogSuGNIvT79KL/gMfwvT/H yrtbT0jr2RRUMDGCsc1pHotTizX2TzXfs/wUbEEEOk0K1yg948gPRB8ZS518JpsMJnMn M2dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=93GuuJd9uEHUPDRXITSItYNyJC9/Yn3GZMio/8PBhsk=; b=Ei01arU3tICSpMRRmwDQLEGUJiIMhvMtQeKttY5Qj15l69yxVPYk9DSjhvnDSlVe2r cDlQYLMmRBmWvhZFDXLQkSHx6Esig6up+64ashwHIDYgqPnLVM/ZFRo263RbIiDXV2Xd kux7JI/PIhHFIuQ4ed2m0sErE+YwcEOkKxggI3WF6OrvxTc2kEv9EGuBLJR/xkAuBIvK EGa1eQFPf3yYMIS8ajKxMofLq46C9tbKKpP6h3xRwlGlJhPIEX1eqMdqHnV4sP/XI2Cx yeUw8/2Zr96W626U1tB9W6kCxBxGZYhBRuwnudHTL5Hfyb5Qq0XYm9fXivKHFuqthIWh BvZQ== X-Gm-Message-State: AD7BkJLb5bsjet2NFkxaSZq8VplGNCJIXoAmEvkcXQEwD2R9usD65Gug2ZDox4hwL4YJ3w== X-Received: by 10.98.8.219 with SMTP id 88mr24493702pfi.51.1457898626737; Sun, 13 Mar 2016 12:50:26 -0700 (PDT) Received: from localhost.localdomain ([64.2.3.194]) by smtp.gmail.com with ESMTPSA id x64sm26755017pfa.72.2016.03.13.12.50.25 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 13 Mar 2016 12:50:25 -0700 (PDT) Received: from localhost.localdomain (apinskidesktop [127.0.0.1]) by localhost.localdomain (8.14.3/8.14.3/Debian-9.4) with ESMTP id u2DJoOfE001927 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Sun, 13 Mar 2016 12:50:24 -0700 Received: (from apinski@localhost) by localhost.localdomain (8.14.3/8.14.3/Submit) id u2DJoOPG001926; Sun, 13 Mar 2016 12:50:24 -0700 From: Andrew Pinski To: pinskia@gmail.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Andrew Pinski Subject: [PATCH 2/2] ARM64:VDSO: Improve __do_get_tspec, don't use udiv Date: Sun, 13 Mar 2016 12:50:20 -0700 Message-Id: <1457898620-1867-3-git-send-email-apinski@cavium.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1457898620-1867-1-git-send-email-apinski@cavium.com> References: <1457898620-1867-1-git-send-email-apinski@cavium.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In most other targets (x86/tile for an example), the division in __do_get_tspec is converted into a simple loop. The main reason for this is because the result of this division is going to be either 0 or 1. This changes the division to the simple loop and thus speeding up gettimeofday. On ThunderX, this speeds up gettimeofday by 16.6%. Signed-off-by: Andrew Pinski --- arch/arm64/kernel/vdso/gettimeofday.S | 27 +++++++++++++++++++-------- 1 files changed, 19 insertions(+), 8 deletions(-) -- 1.7.2.5 diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S index e5caef9..28f4da7 100644 --- a/arch/arm64/kernel/vdso/gettimeofday.S +++ b/arch/arm64/kernel/vdso/gettimeofday.S @@ -246,14 +246,25 @@ ENTRY(__do_get_tspec) mul x10, x10, x11 /* Use the kernel time to calculate the new timespec. */ - mov x11, #NSEC_PER_SEC_LO16 - movk x11, #NSEC_PER_SEC_HI16, lsl #16 - lsl x11, x11, x12 - add x15, x10, x14 - udiv x14, x15, x11 - add x10, x13, x14 - mul x13, x14, x11 - sub x11, x15, x13 + mov x15, #NSEC_PER_SEC_LO16 + movk x15, #NSEC_PER_SEC_HI16, lsl #16 + lsl x15, x15, x12 + add x11, x10, x14 + mov x10, x13 + + /* + * Use a loop instead of a division as this is most + * likely going to be only giving a 1 or 0 and that is faster + * than a division. + */ + cmp x11, x15 + b.lt 1f +2: + sub x11, x11, x15 + add x10, x10, 1 + cmp x11, x15 + b.ge 2b +1: ret .cfi_endproc