mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [patch 12/17] vfs: pagecache usage optimization for pagesize!=blocksize
       [not found]   ` <200808041719.43293.nickpiggin@yahoo.com.au>
@ 2008-08-06  5:36     ` Nick Piggin
  2008-08-12  3:57     ` Hisashi Hifumi
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Piggin @ 2008-08-06  5:36 UTC (permalink / raw)
  To: Christoph Hellwig, linux-mm, linux-kernel
  Cc: akpm, torvalds, hifumi.hisashi, jack, linux-ext4

Any updates with this, please?

On Monday 04 August 2008 17:19, Nick Piggin wrote:
> On Tuesday 29 July 2008 09:00, Christoph Hellwig wrote:
> > On Mon, Jul 28, 2008 at 03:46:36PM -0700, akpm@linux-foundation.org wrote:
> > > From: Hisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp>
> > >
> > > When we read some part of a file through pagecache, if there is a
> > > pagecache of corresponding index but this page is not uptodate, read IO
> > > is issued and this page will be uptodate.
> >
> > I was under the impression we wanted to do this in a nicer way than
> > the hacky method?
>
> This patch unfortunately appears like it may introduce an
> uninitialized memory leak due to a data race between one
> thread initializing a buffer then marking it uptodate, and
> the other testing buffer uptodate then reading from the
> buffer (buffer, read as: page memory covered by buffer head).
>
> For reference, this is basically the same class of data race
> that I fixed 0ed361dec36945f3116ee1338638ada9a8920905
>
> I should have picked up on this before it was merged, but I
> was kind of rushed to review other things before they got
> merged.
>
> I don't think this patch got quite enough justification to
> warrant just blindly putting barriers in the buffer bitops.
> The best-case numbers for it were reasonable enough when the
> downside was only an extra branch or two in a relatively slow
> path. I don't really know how best to go from here (maybe
> someone can argue it is not a problem or come up with a better
> fix?).
>
> Thanks,
> Nick

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 12/17] vfs: pagecache usage optimization for pagesize!=blocksize
       [not found]   ` <200808041719.43293.nickpiggin@yahoo.com.au>
  2008-08-06  5:36     ` [patch 12/17] vfs: pagecache usage optimization for pagesize!=blocksize Nick Piggin
@ 2008-08-12  3:57     ` Hisashi Hifumi
  2008-08-12  6:07       ` Nick Piggin
  1 sibling, 1 reply; 3+ messages in thread
From: Hisashi Hifumi @ 2008-08-12  3:57 UTC (permalink / raw)
  To: Nick Piggin, Christoph Hellwig; +Cc: akpm, jack, linux-kernel, linux-fsdevel

Hi Nick.

>
>This patch unfortunately appears like it may introduce an
>uninitialized memory leak due to a data race between one
>thread initializing a buffer then marking it uptodate, and
>the other testing buffer uptodate then reading from the
>buffer (buffer, read as: page memory covered by buffer head).
>
>For reference, this is basically the same class of data race
>that I fixed 0ed361dec36945f3116ee1338638ada9a8920905

I think the same issue that your patch 0ed361dec36945f3116ee
1338638ada9a8920905 "fix PageUptodate data race" pointed out 
is there around buffer_head without my patch "vfs: pagecache usage 
optimization for pagesize!=blocksize".
Because set_buffer_uptodate or buffer_uptodate are used without
distinct locking facility (lock_buffer, or lock_page) in many places,
so it would be needed to deal with memory ordering issue.

Do you add wmb/rmb to BUFFER_FNS macros?


>
>I don't think this patch got quite enough justification to
>warrant just blindly putting barriers in the buffer bitops.
>The best-case numbers for it were reasonable enough when the
>downside was only an extra branch or two in a relatively slow
>path. I don't really know how best to go from here (maybe
>someone can argue it is not a problem or come up with a better
>fix?).
>
>Thanks,
>Nick


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 12/17] vfs: pagecache usage optimization for pagesize!=blocksize
  2008-08-12  3:57     ` Hisashi Hifumi
@ 2008-08-12  6:07       ` Nick Piggin
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Piggin @ 2008-08-12  6:07 UTC (permalink / raw)
  To: Hisashi Hifumi; +Cc: Christoph Hellwig, akpm, jack, linux-kernel, linux-fsdevel

On Tuesday 12 August 2008 13:57, Hisashi Hifumi wrote:
> Hi Nick.
>
> >This patch unfortunately appears like it may introduce an
> >uninitialized memory leak due to a data race between one
> >thread initializing a buffer then marking it uptodate, and
> >the other testing buffer uptodate then reading from the
> >buffer (buffer, read as: page memory covered by buffer head).
> >
> >For reference, this is basically the same class of data race
> >that I fixed 0ed361dec36945f3116ee1338638ada9a8920905
>
> I think the same issue that your patch 0ed361dec36945f3116ee
> 1338638ada9a8920905 "fix PageUptodate data race" pointed out
> is there around buffer_head without my patch "vfs: pagecache usage
> optimization for pagesize!=blocksize".
> Because set_buffer_uptodate or buffer_uptodate are used without
> distinct locking facility (lock_buffer, or lock_page) in many places,
> so it would be needed to deal with memory ordering issue.

Right.


> Do you add wmb/rmb to BUFFER_FNS macros?

That would fix it, yes. But now the patch is no longer a single
predictable branch but will make the code measurably larger and
slower. On some architectures these can cost hundreds or thousands
of cycles.

So IMO it requires either more thought for a better fix, or we
now need more justification that we want to do this rather than
a artificial microbenchmark numbers.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-08-12  6:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200807282246.m6SMkaHT032267@imap1.linux-foundation.org>
     [not found] ` <20080728230031.GA22218@infradead.org>
     [not found]   ` <200808041719.43293.nickpiggin@yahoo.com.au>
2008-08-06  5:36     ` [patch 12/17] vfs: pagecache usage optimization for pagesize!=blocksize Nick Piggin
2008-08-12  3:57     ` Hisashi Hifumi
2008-08-12  6:07       ` Nick Piggin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®