Received: by 10.223.148.5 with SMTP id 5csp5955919wrq; Wed, 17 Jan 2018 07:42:27 -0800 (PST) X-Google-Smtp-Source: ACJfBovi51Q4Hj+ag2vM/CaUJjMN3+gPTlyU2uJjcMZy/F01V50ScpTjNaTT0G6NO4M5L+v63237 X-Received: by 10.101.77.144 with SMTP id p16mr9401258pgq.106.1516203747225; Wed, 17 Jan 2018 07:42:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516203747; cv=none; d=google.com; s=arc-20160816; b=nGRYTFdFMLXLY+uz9QOtl9C1AT/soQW6EuaRbu2FSAEjmfpjc4j8G8aG4BlFZZLsHv 1NTA0kzi5OBYV+Tstyl6g6O4/l4bkhobr2U6pq2Z4gaf9Xu0aSkn4VTgIQ5VawBj3Saz zoMPEQC9/aQNvrYlMikTfzjpAlu1u5IcAUVV7Salgp2P1T8w51eP1un4Fh5oXV4Wttvw RPNB7rSzL2dmLPBQ/wR6pvH20umQK78tpjgeKWYq0pOshCq6JduHUrxUA1+Cd4ViyVxX TMJHYsxHIjzEI6J7S9Ae971eUnPWq4N43c8Lj3KJIOFwApMKJ960Dvc5FANwfm71APC4 9/5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=1s92vvsjFSrNr1eAPbcVqRh33PhXb+t76wiEeO3WsUs=; b=Hte7i4TCL5tsSioahZBzc2eXD9Gb4QOikehxwC1H7SdRioo8NwpjJoMtpBUXWBPzor VAZeCZemqD2F6XK8uwMXYaFdUbzZAoNRIOhIXPWO0VNc6s+wPp46cYIg/+/m5Oect7dq khIEmVZUT1pVQmCql4vOeINa7fJGF03jxlwwsi4t+B4zlhZSQ3LL+X/oK4L9+xnJVq64 BKlt03Igtz/EYTrAzkb+OHpAiEzfA7qFCpLQyNvXQ1yOnOBMO7vLJaMThVYo639662HO T3r0jwHS1RBF0ohjhAuQPeZn13phKXKVo9sN6ARbZzQP0R2VaY9f6ofEZe2kdSmQuZAm ydyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=yqEnqmYY; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x25si4068818pgc.643.2018.01.17.07.42.13; Wed, 17 Jan 2018 07:42:27 -0800 (PST) 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; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=yqEnqmYY; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753591AbeAQPlv (ORCPT + 99 others); Wed, 17 Jan 2018 10:41:51 -0500 Received: from mail-io0-f180.google.com ([209.85.223.180]:33655 "EHLO mail-io0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752068AbeAQPlo (ORCPT ); Wed, 17 Jan 2018 10:41:44 -0500 Received: by mail-io0-f180.google.com with SMTP id n7so4848255iob.0 for ; Wed, 17 Jan 2018 07:41:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1s92vvsjFSrNr1eAPbcVqRh33PhXb+t76wiEeO3WsUs=; b=yqEnqmYYnA6m33U2tTfm3ATfnrTZa0UPz4XzcSrPgRe4sl1sxjxFU+z7hqVHvDgFH6 H+DwVBjfpKn/KQoD5wCYArc/ZRyBQUWa2ULVIcAa1ioUPJ5idNKK05lXlYRFS7d8e57u VVfZfGukypti2GNAMSay8KO1N0I8Wl5L5eDuQ24XJYpSVwjQlzqfVF1NzFRMsK74HzJ7 RG7BosamvivVwLWYqVO3xT13ZClIoe6TqEisY9jm4VoVMTsqG7Sp/cFw/bq8VOUZnbiw S5u4HXKSQXdl77tJfgu2dKcT+iShc3O9s3wIqOjY1fyBHuFjFAWihTDx0IW7fi/LX+l0 oz6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1s92vvsjFSrNr1eAPbcVqRh33PhXb+t76wiEeO3WsUs=; b=igQnlJKYtHJFtaYxcthrIkK4l9LK2+sgO/iuH9Z/6dBKUGeq2KRVNcXkrC319CtU5I nazzOii2xefq2ASwVySRoCJsAX1kmczciRNFf7L+4jeyaM8/wvs+2QcMgIKPTmuRTPea 14YOuoOkZH5ktXi4voAKhRnXF6CsBVSnfLTzAUdnjfCeVA8Hbooxuc6sRs6lFDDxTgha YtJPEZbL6AU/OvVMTUXn4RARgj0OsCfjOFF5A1vPCSpks44QDYPGh+9QNniGHmGLx2iJ MM9xEfDcTuywC7OysN4OfaZ8Edf/2bCfWbf9B/NDJK2iYpG5QxRbEIu5QNE8Jy3bJMnh wsiw== X-Gm-Message-State: AKwxytdZO5eZxPNgGS9f7k+QQIBP1SxXQNVy4dL8wZKHp5tsAW1MeD+C QAvNN9lD58Az2DFftG0ALTHnZfvn634= X-Received: by 10.107.51.212 with SMTP id z203mr43635995ioz.278.1516203703779; Wed, 17 Jan 2018 07:41:43 -0800 (PST) Received: from [192.168.1.160] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id 202sm2567322ioz.84.2018.01.17.07.41.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jan 2018 07:41:43 -0800 (PST) Subject: Re: [PATCH] [RESEND] aoe: use ktime_t instead of timeval To: Arnd Bergmann , "Ed L. Cashin" Cc: Tina Ruchandani , linux-kernel@vger.kernel.org References: <20180117153052.3831762-1-arnd@arndb.de> From: Jens Axboe Message-ID: <7b4d1840-103f-dfb8-3918-678fdc93d816@kernel.dk> Date: Wed, 17 Jan 2018 08:41:42 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Thunderbird/58.0 MIME-Version: 1.0 In-Reply-To: <20180117153052.3831762-1-arnd@arndb.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/17/18 8:30 AM, Arnd Bergmann wrote: > From: Tina Ruchandani > > 'struct frame' uses two variables to store the sent timestamp - 'struct > timeval' and jiffies. jiffies is used to avoid discrepancies caused by > updates to system time. 'struct timeval' is deprecated because it uses > 32-bit representation for seconds which will overflow in year 2038. > > This patch does the following: > - Replace the use of 'struct timeval' and jiffies with ktime_t, which > is the recommended type for timestamping > - ktime_t provides both long range (like jiffies) and high resolution > (like timeval). Using ktime_get (monotonic time) instead of wall-clock > time prevents any discprepancies caused by updates to system time. > > [updates by Arnd below] > The original patch from Tina never went anywhere as we discussed how > to keep the impact on performance minimal. I've started over now but > arrived at basically the same patch that she had originally, except for > an slightly improved tsince_hr() function. I'm making it more robust > against overflows, and also optimize explicitly for the common case > in which a frame is less than 4.2 seconds old, using only a 32-bit > division in that case. > > This should make the new version more efficient than the old code, > since we replace the existing two 32-bit division in do_gettimeofday() > plus one multiplication with a single single 32-bit division in > tsince_hr() and drop the double bookkeeping. It's also more efficient > than the ktime_get_us() API we discussed before, since that would > also rely on multiple divisions. Applied, thanks Arnd/Tina. -- Jens Axboe