Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1954089ybh; Fri, 17 Jul 2020 05:58:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSfwRXO0IMEPDCN7Jjfazn8VXj+Nnyk3prs1QAeJ7VCXJR+dR3WkPCGozPRs73bfbH1j4i X-Received: by 2002:a17:906:4c48:: with SMTP id d8mr8064694ejw.331.1594990737606; Fri, 17 Jul 2020 05:58:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594990737; cv=none; d=google.com; s=arc-20160816; b=XHuuETcDmJ09Lb7D3KcG349RVdARQj+KADLYkX6KnO1trqIivaKfnwmcbBDJtCNFdF U9rEDcdRkszisXhO66rc3T4SXVqvLd+cXvw1jfya7VlBq3dGsDJR8uSTEOuBySJl3LPe SMUR7btNVMLyDhqn8lYtCXqPiHQYeyvMzelMUdqk0zULeCp2FIKHGflOIXS1+2T18VNY c4SkyelMW/nnIGNNvAnukJx3e3+nW+coWO7RNyRqGToZ78zH62WusoVN1QU3HhuHc+Jl RTMAIoJjNnKkAi5C87bYRg7UitDgZwKr4k6tbKPTOAWVw1nLqyS2tzFvng3IdjKT4f/q fPTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=mfERKrZfhocm+Qg2YTLcEu6HdQGc/TVg4v9pN6QKIMw=; b=g8Xwh0W7gmVeyAHmtuWY31qNC/jPYSor49OWcmZ9vPD52K4vc6uexmM48tl0mk2DqK zOIgWBeE6cVwZJDFNHCL2xIc7MLXlccixnXBUQL5QnbERVZpi2CuUvYGbk51J3cd0Vge HRFP7y+LmAQMXuG2cDu7ZzWi+jG8306ot/hk84GOq12yvJtoZiNb2yUn2vZV/PSIxafe cheoqK86qr9CpPKHfQCxy3CIXSiAZ2Xl0C7Sc4mVq2I/DhdMs9FMgJSj2y/1RMg9SNxb FZ3I8aNgP4FqpnnjRvzpz4q6et4MrwU5wGKGp1trTEFeMLTUxRcfaNgPxSmvtao6OxTU zPMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KbPOrEdI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z11si5078303edr.395.2020.07.17.05.58.34; Fri, 17 Jul 2020 05:58:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KbPOrEdI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726803AbgGQMz6 (ORCPT + 99 others); Fri, 17 Jul 2020 08:55:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:55974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726238AbgGQMz6 (ORCPT ); Fri, 17 Jul 2020 08:55:58 -0400 Received: from localhost (lfbn-ncy-1-317-216.w83-196.abo.wanadoo.fr [83.196.152.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C861620734; Fri, 17 Jul 2020 12:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594990558; bh=Y6XnGiof5mCpun2xOmNqnPCEUbw0B+sdJVBNATJLVRg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KbPOrEdIMgRkcOfoUUB/exi1y9bWBx3Cr/Dh7CGuVI6ce96Oy3qZES6MWG8tGTkoX KYzf5uxoWEbW+7ghVrPfJmE/qVSjt1s8vv60iJ2fsNnTfIvXHD200DITJ/1PDW1aby CJofA4JOJCqw1VLq9z4CiQYThq5KKRAEOyqp5Xq0= Date: Fri, 17 Jul 2020 14:55:56 +0200 From: Frederic Weisbecker To: Thomas Gleixner Cc: LKML , Anna-Maria Gleixner , Peter Zijlstra , Juri Lelli Subject: Re: [PATCH 2/9] timer: Add comments about calc_index() ceiling work Message-ID: <20200717125555.GB25465@lenoir> References: <20200707013253.26770-1-frederic@kernel.org> <20200707013253.26770-3-frederic@kernel.org> <87tuyav4qx.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87tuyav4qx.fsf@nanos.tec.linutronix.de> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 14, 2020 at 11:13:26AM +0200, Thomas Gleixner wrote: > Frederic Weisbecker writes: > > static inline unsigned calc_index(unsigned expires, unsigned lvl) > > { > > + /* > > + * Time may have past since the clock last reached an index of > > + * this @lvl. And that time, below LVL_GRAN(@lvl), is going to > > + * be substracted from the delta until we reach @expires. To > > + * fix that we must add one level granularity unit to make sure > > + * we rather expire late than early. Prefer ceil over floor. > > This comment confuses the hell out of me. Me too... > > /* > * The timer wheel has to guarantee that a timer does not fire > * early. Early expiry can happen due to: > * - Timer is armed at the edge of a tick > * - Truncation of the expiry time in the outer wheel levels > * > * Round up with level granularity to prevent this. > */ > > Hmm? That's relieving, I'm updating the patch. Thanks!