Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1604773ybh; Tue, 14 Jul 2020 02:16:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQrAYs930aUBSzgoY7NQ/gvnmURhEpQ0RPVAWODJ+U9W4xMFd0hTOJomP68KjwLIKtbvgz X-Received: by 2002:a17:906:aac1:: with SMTP id kt1mr3822230ejb.408.1594718169030; Tue, 14 Jul 2020 02:16:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594718169; cv=none; d=google.com; s=arc-20160816; b=F+7f5DMGKDKO7Gt6YK0nLkqBEL2GH1YAdEt0G6+Xk+bywsV1/MEkeBzy6qra8zmFT4 ALrkb7YMngs7sUdqE/4eO95IwOwYpEVcSNDAiaHXE2k211xmoaNkBal58Ro3tJLjVDmu F7sMuxSDD3hUP60D3FfrQ4+ZzKS0pcruDqvLZZKWt3LgphxPVrMpT+GNeYTw7yVE0KE0 6d4wV9upUtPGFE6YLwM5FxGNQNToojjPmD+nr60uQdUqXOhx/An704ofwitrt9V2q4DE yEbOvrvyuIFVrS3jJ+BFcELoWG1LBM7GxKldGt71xZNDy5V3uFMwbSWDL8dLaCOcIX83 HMiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=8ad5Ds6y4Cwxz0EA9bWnm/7kcoiw95HIzl75sRuD+Ac=; b=H62gbGB2VLF4pzgiZbLtfvURTCBRJGaQi6YPLJq5KfETvbDNUQPvDT/G1nHR+NxOg7 IYZ+QCPqNRi7lb3KwA/2egksr6WjGTOowCqr8PaoeHxWbexd76lRcn3Y80b0Q75H7aSM 6lOViGkyKWCj1GIQQkul7/1JFBL1JqjoZnkfYnwfVL6Go5+WZd0NTJu97sXm+L9+u6OJ YCyVOqqCNpInhgmxVwrjLHZKhNf98b+rzMwbfHv/riRzmRFGPSigSpUlW8Aed0UvH5cD Yw+Xl7FSkD2zpfIGNKmeTwJSWXIaehBL4qA1j00Mq20M0buifxHpDLFuJBydFGaIcU7Q p8kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="RK1/AHX1"; dkim=neutral (no key) header.i=@vger.kernel.org; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x65si11904881ede.585.2020.07.14.02.15.46; Tue, 14 Jul 2020 02:16:09 -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=@linutronix.de header.s=2020 header.b="RK1/AHX1"; dkim=neutral (no key) header.i=@vger.kernel.org; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727095AbgGNJN2 (ORCPT + 99 others); Tue, 14 Jul 2020 05:13:28 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:42426 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727081AbgGNJN2 (ORCPT ); Tue, 14 Jul 2020 05:13:28 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1594718006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8ad5Ds6y4Cwxz0EA9bWnm/7kcoiw95HIzl75sRuD+Ac=; b=RK1/AHX1Rve2bsD2WogQoxhSXwX9sHKm7rT41BX+73vjXmCqdEynjA8IQj8sv9s/3MRJkl 7wsONs10Lnv6MxBX8s3p0LVcNZI7hiUXqFGcWPjPdinhNN16X8KpS71PVSUoBtz4j6dOxQ tlRnv6LI3eewOUpA85L6bGhr/sUEhcvrry5tUswQ7krfEMAWLvSFUx5pUZ5TZjFgEoHNMo SkAwHf/xxr5XA34UaVcmCuD7P9KDGK4C+5iMRD2WT1IVIK8HFezod7Fmk4umFc884QNUgg KT/+MGsgLEiwV34COnPbAfvYmgVfH3x7XAI2FPdc40OlkVIQ8CIT0V8YEpoxsQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1594718006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8ad5Ds6y4Cwxz0EA9bWnm/7kcoiw95HIzl75sRuD+Ac=; b=UF/8CrTM1V/tJQbuBTT0/KNsCOaRx49ZdJWeyJxpZ0WhtFKXq6SR6DuOscvYQbSmZ8sw7b uITmx7VQkw60JaAA== To: Frederic Weisbecker Cc: LKML , Frederic Weisbecker , Anna-Maria Gleixner , Peter Zijlstra , Juri Lelli Subject: Re: [PATCH 2/9] timer: Add comments about calc_index() ceiling work In-Reply-To: <20200707013253.26770-3-frederic@kernel.org> References: <20200707013253.26770-1-frederic@kernel.org> <20200707013253.26770-3-frederic@kernel.org> Date: Tue, 14 Jul 2020 11:13:26 +0200 Message-ID: <87tuyav4qx.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. /* * 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? Thanks, tglx