From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.toke.dk (mail.toke.dk [IPv6:2001:470:dc45:1000::1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 96A5F3CB36 for ; Wed, 16 May 2018 14:34:18 -0400 (EDT) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1526495656; bh=apxHENNKaXmXfB2lOWuxUK+9ddhws44ZdyR0/Szwf/4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=xxxl/Ut/6kZdZRdUCG6cjjMsM+D9jUDKnPbsVDFSH/hWZ1FypUZf4D+KPHJfFvuQM IIjiIpRP7Jf/mOLVbgv/iV+5oKjTDyZ8LAzm+tPbzghplQ3K3uBHGtQ4UDxkJCpIm+ Vj/H0Gb5Pq/ncETXwdSPhC61hpvjREdbb4wF4R5st7Sz12nPW7ktOHKmh5oemgm1Py xNL7YDrjTqWSmuPcfJ8TnMI7B9roVtcRVEyEuzeqq9Y3ejzcLUGOu0ocPVk3QE+FSp hPLN2Iekuk5aDhid6H2m+3KoiJcYm3IFom/bLpKHJRT8WoQNDh7nQEsEGr33mTExwv QeCLLlEH37oCg== To: David Miller Cc: netdev@vger.kernel.org, cake@lists.bufferbloat.net In-Reply-To: <20180516.140203.2185491961233997679.davem@davemloft.net> References: <152639705919.2525.3718182212727523960.stgit@alrua-kau> <152639716493.2525.13568513738420279599.stgit@alrua-kau> <20180516.140203.2185491961233997679.davem@davemloft.net> Date: Wed, 16 May 2018 20:34:11 +0200 X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <87vabnv49o.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Cake] [PATCH net-next v11 1/7] sched: Add Common Applications Kept Enhanced (cake) qdisc X-BeenThere: cake@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: Cake - FQ_codel the next generation List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 May 2018 18:34:18 -0000 David Miller writes: > From: Toke H=C3=B8iland-J=C3=B8rgensen > Date: Tue, 15 May 2018 17:12:44 +0200 > >> +typedef u64 cobalt_time_t; >> +typedef s64 cobalt_tdiff_t; > ... >> +static cobalt_time_t cobalt_get_time(void) >> +{ >> + return ktime_get_ns(); >> +} >> + >> +static u32 cobalt_time_to_us(cobalt_time_t val) >> +{ >> + do_div(val, NSEC_PER_USEC); >> + return (u32)val; >> +} > > If fundamentally you are working with ktime_t values, please use that type > and the associated helpers. > > This is a valid argument that using custom typedefs provide documentation > and an aid to understanding, but I think it doesn't serve that purpose > very well here. > > So please just use ktime_t throughout instead of this cobalt_time_t > and cobalt_tdiff_t. And then use helpers like ktime_to_us() which > properly optimize for 64-bit vs. 32-bit hosts. Can do :) -Toke