All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel McNeil <daniel@osdl.org>
To: Andrew Morton <akpm@digeo.com>
Cc: Andrea Arcangeli <andrea@suse.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2.5.68 2/2] i_size atomic access
Date: 29 Apr 2003 17:40:44 -0700	[thread overview]
Message-ID: <1051663244.2451.20.camel@ibm-c.pdx.osdl.net> (raw)
In-Reply-To: <1051312669.2446.85.camel@ibm-c.pdx.osdl.net>

Andrew,

I did some simple stat() testing to see what the overhead of using
i_size_read() or i_sem to protect i_size.  On my 1.7GHZ XEON 2-proc
a stat() took:

1 process:

1.5 microseconds 2.5.68
1.7 microseconds 2.5.68-isize
1.7 microseconds 2.5.68 using i_sem

When having 2 processes stat() the same file, I got

1.5 microseconds 2.5.68
1.7 microseconds 2.5.68-isize
2.0 microseconds 2.5.68 using i_sem.

Doing a down()/up() is about the same overhead as doing a read seqlock
with no contention.  With contention, the seqlock scales as we would
expect and the i_sem does not.

The overhead for the seqlock is small and gives correct i_size results.

I'm still trying to think of a way to get a test to show the problem
in some place besides sys_stat().

Daniel



On Fri, 2003-04-25 at 16:17, Daniel McNeil wrote:
> On Fri, 2003-04-25 at 03:57, Andrew Morton wrote:
> > Andrea Arcangeli <andrea@suse.de> wrote:
> > >
> > > On Thu, Apr 24, 2003 at 06:05:03PM -0700, Andrew Morton wrote:
> > > > And if the race _does_ hit, what is the effect?  Assuming stat() was fixed
> > > > with i_sem, I don't think the race has a very serious effect.  We won't
> > > 
> > > writepage needs it too to avoid returning -EIO and I doubt you want to
> > > take the i_sem in writepage
> > 
> > Well the -EIO thing is bogus really, but yes.  The writepage will not hit
> > disk *at all*.  That's a problem.
> > 
> > We modify i_size in very few places - an alternative might be to maintain a
> > parallel unsigned long i_size>>PAGE_CACHE_SIZE in the inode and use that in
> > critical places.  Sounds messy though.
> > 
> > Ho hum.  ugh.
> 
> It is problems like this that worry me.  Wouldn't this cause silent data
> corruption?  My stat() test just shows the window is small but there.
> Of course, I would also prefer that stat() always gives the right
> answer.  Taking i_sem in sys_stat() would add more overhead to
> sys_stat() and it would write the inode cache line.
> 
> The overhead on reading i_size is an extra 4-bytes and and 2 rmb()s
> and this in only on preempt or SMP.  Also, i_size_read() only reads
> the inode fields, so on SMP it does not bounce the cache lines around.
> 
> The overhead on the write side is very small with just the updates to
> the sequence value.
> 
> I ran some bonnie++ tests on 2-proc machines and did not notice any
> difference between 2.5.68 and 2.5.68-isize.
> 
> The i_size patch fixes the file systems that use the generic interfaces
> and added i_size_write()s for ext3.  I wanted to get these changes in
> before checking and fixing all the other file systems.
> 
> I'll see if I can think up a test to see the problem shows up somewhere
> besides sys_stat.  Any ideas?
> 
> Any ideas on tests to run to measure the overhead of this patch?
> 
> Thanks,


      reply	other threads:[~2003-04-30  0:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-25  0:30 [PATCH 2.5.68 2/2] i_size atomic access Daniel McNeil
2003-04-25  1:05 ` Andrew Morton
2003-04-25  1:42   ` Andrea Arcangeli
2003-04-25 10:57     ` Andrew Morton
2003-04-25 23:17       ` Daniel McNeil
2003-04-30  0:40         ` Daniel McNeil [this message]

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=1051663244.2451.20.camel@ibm-c.pdx.osdl.net \
    --to=daniel@osdl.org \
    --cc=akpm@digeo.com \
    --cc=andrea@suse.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.