linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0 of 8] O_DIRECT locking rework v5
@ 2006-12-22  1:45 Chris Mason
  2006-12-22  1:52 ` [PATCH 1 of 8] Introduce a place holder page for the pagecache Chris Mason
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Chris Mason @ 2006-12-22  1:45 UTC (permalink / raw)
  To: linux-fsdevel, akpm, zach.brown

[ resend, sorry for the messed up headers ]

I took a small detour on the O_DIRECT locking rework to look at
different alternatives for range locking in the pagecache.  After
benchmarking a few different types of trees, I didn't find anything that
would match radix for random lookup performance.

This patchset does ranges in the radix tree by inserting a placeholder
at the last slot in the range and forcing all lookups to search forward.
It means radix_tree_gang_lookup must be used instead of
radix_tree_lookup, but this is still faster for random searches than
anything else I tried.

A bit is set on the radix root node to indicate if range searching is
required.  So, when O_DIRECT isn't used or O_DIRECT is used for tiny
ios, no range lookups are done.

With O_DIRECT in use, only a single placeholder is inserted
to lock down the entire range for a given IO.  This should
stand up pretty well for those monster XFS workloads.

If the mapping has pages on it, I do one placeholder for every 64k
to limit the number of pages pinned down during the IO.  There's
lots of hand waving here, it may be best to get rid of this special
case.

Patch against Linus' git from today.  Testing has been light, I'm
mostly looking for comments on the range locking tricks.

-chris

^ permalink raw reply	[flat|nested] 13+ messages in thread
* [RFC PATCH 0 of 8] O_DIRECT locking rework
@ 2007-02-07  0:32 Chris Mason
  2007-02-07  0:32 ` [PATCH 2 of 8] Change O_DIRECT to use placeholders instead of i_mutex/i_alloc_sem locking Chris Mason
  0 siblings, 1 reply; 13+ messages in thread
From: Chris Mason @ 2007-02-07  0:32 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: akpm

Hello everyone,

Here's a respin of the O_DIRECT locking changes.  There are some minor
updates, mostly cleanups based on suggestions from Zach Brown and Dave
Chinner.

Linus found a deadlock between the placeholders and the page fault handler
when userland uses an mmap of the file as the O_DIRECT buffer.  I'm
getting around that by capping placeholder extents at DIO_PAGES (64)
intervals when the file has mappings.  This matches the interval used by
get_user_pages and makes sure get_user_pages has been called on a given
range in the address space before placeholders are added.

I also hit a stale data exposure when get_block returns data past the
end of the placeholder extent.  A concurrent readpage could come in and
find metadata before the data had gotten to disk.  The fix is to
only ask get_block for data up to the end of the placeholder.

Generally, this isn't a problem because the common case is for
a single placeholder to cover the entire DIO.  So the suboptimal
allocation result wouldn't happen very often.

-chris


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

end of thread, other threads:[~2007-02-07 20:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-22  1:45 [PATCH 0 of 8] O_DIRECT locking rework v5 Chris Mason
2006-12-22  1:52 ` [PATCH 1 of 8] Introduce a place holder page for the pagecache Chris Mason
2006-12-22  1:55 ` [PATCH 2 of 8] Change O_DIRECT to use placeholders instead of i_mutex/i_alloc_sem locking Chris Mason
2006-12-22  1:57 ` [PATCH 3 of 8] DIO: don't fall back to buffered writes Chris Mason
2006-12-22  1:59 ` [PATCH 4 of 8] Add flags to control direct IO helpers Chris Mason
2006-12-22  2:00 ` [PATCH 5 of 8] Make ext3 safe for the new DIO locking rules Chris Mason
2006-12-22  2:02 ` [PATCH 6 of 8] Make reiserfs safe for " Chris Mason
2006-12-22  2:03 ` [PATCH 7 of 8] Adapt XFS to the new blockdev_direct_IO calls Chris Mason
2006-12-22  2:05 ` [PATCH 8 of 8] Avoid too many boundary buffers in DIO Chris Mason
  -- strict thread matches above, loose matches on Subject: below --
2007-02-07  0:32 [RFC PATCH 0 of 8] O_DIRECT locking rework Chris Mason
2007-02-07  0:32 ` [PATCH 2 of 8] Change O_DIRECT to use placeholders instead of i_mutex/i_alloc_sem locking Chris Mason
2007-02-07 20:11   ` Zach Brown
2007-02-07 20:22     ` Chris Mason
2007-02-07 20:34       ` Zach Brown

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).