lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1408643084.23250.84.camel@joe-AO725>
Date:	Thu, 21 Aug 2014 10:44:44 -0700
From:	Joe Perches <joe@...ches.com>
To:	Dan Williams <dan.j.williams@...el.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Dave Young <hidave.darkstar@...il.com>
Cc:	Manuel Schölling <manuel.schoelling@....de>,
	Vinod Koul <vinod.koul@...el.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
	"dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] ioat: Use time_before()

On Thu, 2014-08-21 at 10:10 -0700, Dan Williams wrote:
> On Thu, May 22, 2014 at 1:11 PM, Manuel Schölling
> <manuel.schoelling@....de> wrote:
> > To be future-proof and for better readability the time comparisons are modified
> > to use time_before() instead of plain, error-prone math.
[]
> > diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
[]
> > @@ -735,7 +735,8 @@ int ioat2_check_space_lock(struct ioat2_dma_chan *ioat, int num_descs)
> >          * called under bh_disabled so we need to trigger the timer
> >          * event directly
> >          */
> > -       if (jiffies > chan->timer.expires && timer_pending(&chan->timer)) {
> > +       if (time_before(chan->timer.expires, jiffies)
> > +           && timer_pending(&chan->timer)) {
> >                 struct ioatdma_device *device = chan->device;
> 
> Thanks, let's use time_is_before_jiffies() for this cleanup... I'll
> fix up and apply.

There are thousands of uses of time_before( and time_after(
with jiffies, and 6 years after being added, a little more
than a dozen or so of time_is_[before|after]_jiffies.

I also think the "time_is_[before|after]_jiffies" macros are
not very well named.

Using them is more text than using jiffies directly.
There is a small benefit in argument ordering correctness.

	time_after(jiffies, foo)
	time_is_after_jiffies(foo)

I'd rather just drop jiffies altogether
	time_is_after(foo)
or maybe add and use
	jiffies_is_after(foo)

(all the other after_eq/before/before_eq variants too).

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ