Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2129973ybb; Sun, 29 Mar 2020 23:27:37 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsHLhfFYt8/rNVG4xsm9yCN1B3XUFi2+gfBf+eq03e5daNvGzAzdQXv1B0RhNTBL3Mzpy10 X-Received: by 2002:a9d:5191:: with SMTP id y17mr8320749otg.267.1585549657176; Sun, 29 Mar 2020 23:27:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585549657; cv=none; d=google.com; s=arc-20160816; b=VWVQ/DhAOZXlMbYmnPTYLejYhsD5/dF2tHrfhPf0qvVX+2EVI/0kVFi6vGauZad604 a2zeZrFLKPgnogtglY+50gYcxchGCbprEO2SYoACiXn4Ma7uJf+7XlPhE8EKiK7fhQzK eu4OLbaDUI436d6ZvnIRCiV+aUVTgEVs+7D6ZQfxpnUnz7udOlqQLXxIKk/bjbuzZJRM 5c4+94Bujb8hmx/Z2ksxzLCEIta4qnRo+TgaoXHWKDMUwQvwihHHx/X8QEzy9RuuBrYT CihyXXMdI9HvgBEX4i/wtFGxYJh0sLXYHmgGw9Znk/hQuAwZMsEmDgnXZ425BkFwX8WW Np4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=MzHBJ8XE4ZH/4qgXlrzUjb051vdHvbN2aD4Q+p38c80=; b=VypbJ6IIFXz2rXyLKeZpMPOhqiiZQPYC7Wd1awFc43CIwfboErB19AIyVkZu9mUUuj b2TxdrBS61mriRLLxvmD2H1LjQBnHUoeJ0O+HPPGe3OrzRXQuIy/wGdgzI7Dock/Z1Rk P1RjBiE/SxCp6be2t8imVDUiVe/RGUwm086kBO4Nvpgog492jOLru+4kbvZbkuOytDzq rd+i+VIpgqlqmInCREX+zLkO3ZTKL2/C/8xy6I/eqOplGTLvDS8ysmcYwKU4WQUturT5 znazZaerdLP8RpkGKXTiQF6yy3PjRyQRWcWEvAhydbq75z+586f2SxwsTLjwYt8+VXC7 b4Sg== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j15si5631739oos.59.2020.03.29.23.27.24; Sun, 29 Mar 2020 23:27:37 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729021AbgC3G1I (ORCPT + 99 others); Mon, 30 Mar 2020 02:27:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:44476 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728489AbgC3G1I (ORCPT ); Mon, 30 Mar 2020 02:27:08 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C9E57AB8F; Mon, 30 Mar 2020 06:27:05 +0000 (UTC) Date: Mon, 30 Mar 2020 08:27:01 +0200 Message-ID: From: Takashi Iwai To: James Bottomley Cc: George Spelvin , linux-kernel@vger.kernel.org, Hannes Reinecke , linux-scsi@vger.kernel.org, Marek Lindner , Simon Wunderlich , Antonio Quartulli , Sven Eckelmann , b.a.t.m.a.n@diktynna.open-mesh.org, Johannes Berg , linux-wireless@vger.kernel.org, Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org Subject: Re: [RFC PATCH v1 13/50] Avoid some useless msecs/jiffies conversions In-Reply-To: <1585505807.4510.1.camel@HansenPartnership.com> References: <202003281643.02SGhBrh000992@sdf.org> <20200329121129.GC11951@SDF.ORG> <20200329175032.GE4675@SDF.ORG> <1585505807.4510.1.camel@HansenPartnership.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") 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 Sun, 29 Mar 2020 20:16:47 +0200, James Bottomley wrote: > > On Sun, 2020-03-29 at 17:50 +0000, George Spelvin wrote: > > On Sun, Mar 29, 2020 at 07:13:33PM +0200, Takashi Iwai wrote: > > > On Sun, 29 Mar 2020 14:11:29 +0200, George Spelvin wrote: > > > > On Sun, Mar 29, 2020 at 09:52:23AM +0200, Takashi Iwai wrote: > > > > > I thought the compiler already optimizes to the constant > > > > > calculation > > > > > for the above case? > > > > > > > > It optimizes that if the entire argument, including "seconds", is > > > > a compile-time constant. > > > > > > > > However, given "msecs_to_jiffies(hdev->rpa_timeout * 1000);", > > > > the computatin is non-trivial. > > > > > > Fair enough. But it's still a question whether an open code X * HZ > > > is > > > good at all... > > > > I'm sorry, I don't understand what you mean by "good at all" here. > > The value computed is exactly the same. > > I think he means what the compiler does with it. > > We all assume that msecs_to_jiffies is properly optimized so there > should be no need to open code it like you're proposing. Yes, it'd be best if the compiler can handle it properly. But also I meant to keep using the macro for consistency reason. IIRC, we wanted to eliminate the explicit use of HZ in the past, and it's how many lines have been converted with *_to_jiffies() calls. I don't know whether the eliminate of HZ is still wished, but reverting to the open code is a step backward for that. thanks, Takashi