From: Andrew Morton <akpm@linux-foundation.org>
To: Jeff Layton <jlayton@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] writeback: guard against jiffies wraparound on inode->dirtied_when checks (try #2)
Date: Tue, 31 Mar 2009 18:07:30 -0700 [thread overview]
Message-ID: <20090331180730.049d42e7.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090331205018.228ea5f8@tleilax.poochiereds.net>
On Tue, 31 Mar 2009 20:50:18 -0400 Jeff Layton <jlayton@redhat.com> wrote:
> On Tue, 31 Mar 2009 17:20:31 -0700
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > On Tue, 31 Mar 2009 20:03:59 -0400
> > Jeff Layton <jlayton@redhat.com> wrote:
> >
> > > + * It's not sufficient to just do a time_after() check on
> > > + * dirtied_when. That assumes that dirtied_when will always
> > > + * change within a period of jiffies that encompasses half the
> > > + * machine word size (2^31 jiffies on 32-bit arch). That's not
> > > + * necessarily the case if an inode is being constantly
> > > + * redirtied. Since dirtied_when can never be in the future,
> > > + * we can assume that if it appears to be so then it is
> > > + * actually in the distant past.
> >
> > so this really is a 32-bit-only thing.
> >
> > I guess that isn't worth optimising for though.
> >
>
> Yeah, it's pretty much impossible to hit this on a 64-bit machine.
>
> > otoh, given that all three comparisons are the same:
> >
> > + time_after(inode->dirtied_when, *older_than_this) &&
> > + time_before_eq(inode->dirtied_when, jiffies))
> >
> > (although one is inverted (i think?)), it might end up nicer if this was all done
> > in a little helper function?
> >
> > That way we only need to comment what's going on at a single site, and
> > we could omit the additional test if !CONFIG_64BIT.
>
> Ok, that seems reasonable.
>
> At one point I had a macro similar to time_in_range(), but dropped it
> primarily because time_after_but_before_eq() wasn't easy on the eyes.
> Thoughts on better names?
I was thinking
bool inode_dirtied_after(...);
and just leave the innards using time_after() and time_before_eq()?
next prev parent reply other threads:[~2009-04-01 1:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-01 0:03 [PATCH] writeback: guard against jiffies wraparound on inode->dirtied_when checks (try #2) Jeff Layton
2009-04-01 0:20 ` Andrew Morton
2009-04-01 0:50 ` Jeff Layton
2009-04-01 1:07 ` Andrew Morton [this message]
2009-04-01 6:56 ` Wu Fengguang
2009-04-01 11:53 ` Jeff Layton
2009-04-01 12:26 ` Wu Fengguang
2009-04-01 12:48 ` Jeff Layton
2009-04-01 13:07 ` Wu Fengguang
2009-04-01 14:35 ` Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090331180730.049d42e7.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=jlayton@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).