From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5A90C43142 for ; Tue, 31 Jul 2018 14:34:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6AE4E20841 for ; Tue, 31 Jul 2018 14:34:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6AE4E20841 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732364AbeGaQPS (ORCPT ); Tue, 31 Jul 2018 12:15:18 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:59878 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732231AbeGaQPS (ORCPT ); Tue, 31 Jul 2018 12:15:18 -0400 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fkVjR-0005wV-Is; Tue, 31 Jul 2018 16:34:37 +0200 Date: Tue, 31 Jul 2018 16:34:37 +0200 (CEST) From: Thomas Gleixner To: Xu YiPing cc: john.stultz@linaro.org, sboyd@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] timers: fix offset calculation when the expires align with LVL_GRAN In-Reply-To: Message-ID: References: <1532669610-103892-1-git-send-email-xuyiping@hisilicon.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 31 Jul 2018, Thomas Gleixner wrote: > On Tue, 31 Jul 2018, Xu YiPing wrote: > > On 2018/7/30 19:03, Thomas Gleixner wrote: > > > > > > __internal_add_timer(base, timer) > > > { > > > idx = calc_wheel_index(1, 1) > > > { > > > delta = 1 - 1; <- 0 > > > > > > if (0 < LVL_START(1)) > > > idx = calc_index(1, 0) > > > { > > > expires = (1 + LVL_GRAN(0) - 1) >> LVL_SHIFT(0); > > > ----> expires = 0 > > > > LVL_GRAN(0) = 1 and LVL_SHIFT(0) = 0 > > > > after the calculation, expires = 1 ? > > Indeed. You're right. Math is hard... So the index would be 1 and still not > fulfil the below: Hmm, crap. Let me think about it some more. 34C is way too hot to think. Thanks, tglx