Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Nov 2013 19:19:47 -0500 (EST)
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        Kirk McKusick <mckusick@mckusick.com>
Cc:        FreeBSD FS <freebsd-fs@freebsd.org>
Subject:   Re: RFC: NFS client patch to reduce sychronous writes
Message-ID:  <1476192898.22291791.1385597987782.JavaMail.root@uoguelph.ca>
In-Reply-To: <201311272320.rARNKEKQ045789@chez.mckusick.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Kirk wrote:
> > Date: Wed, 27 Nov 2013 17:50:48 -0500 (EST)
> > From: Rick Macklem <rmacklem@uoguelph.ca>
> > To: Konstantin Belousov <kostikbel@gmail.com>
> > Subject: Re: RFC: NFS client patch to reduce sychronous writes
> > 
> > Kostik wrote:
> >> Sorry, I do not understand the question. mmap(2) itself does not
> >> change
> >> file size.  But if mmaped area includes the last page, I still
> >> think
> >> that the situation I described before is possible.
> > 
> > Yes, I'll need to look at this. If it is a problem, all I can think
> > of
> > is bzeroing all new pages when they're allocated to the buffer
> > cache.
> > 
> > Thanks for looking at it, rick
> > ps: Btw, jhb@'s patch didn't have the bzeroing in it.
> 
> The ``fix'' of bzero'ing every buffer cache page was made to UFS/FFS
> for this problem and it killed write performance of the filesystem
> by nearly half. We corrected this by only doing the bzero when the
> file is mmap'ed which helped things considerably (since most files
> being written are not also bmap'ed).
> 
> 	Kirk
> 
Ok, thanks. I've been trying to reproduce the problem over NFS and
haven't been able to break my patch. I was using the attached trivial
test program and would simply make a copy of the source file (529 bytes)
to test on. I got the same results both locally and over NFS:
- built without -DWRITEIT, the setting of a value after EOF would be
  lost, because nothing grew the file from 529 bytes to over 4080bytes.
- built with -DWRITEIT, both the 'A' and 'B' are in the result, since
  my patch bzeros the grown segment in the write(2) syscall.

- If I move the write (code in #ifdef WRITEIT) to after the "*cp"
  of the mapped page, the 'A' assigned to "*cp" gets lost for
  both UFS and NFS.
  Is this correct behaviour?

If it is correct behaviour, I can't see how the patch is broken, but
if you think it might still be, I'll look at doing what Kirk suggests,
which is bzeroing all new buffer cache pages when the file is mmap()d.

Thanks for the help, rick






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1476192898.22291791.1385597987782.JavaMail.root>