All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Denis Vlasenko <vda.linux@googlemail.com>
Cc: Bill Davidsen <davidsen@tmr.com>, Hugh Dickins <hugh@veritas.com>,
	Linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: open(O_DIRECT) on a tmpfs?
Date: Fri, 05 Jan 2007 16:30:23 +1100	[thread overview]
Message-ID: <459DE26F.4040103@yahoo.com.au> (raw)
In-Reply-To: <200701042317.02908.vda.linux@googlemail.com>

Denis Vlasenko wrote:
> On Thursday 04 January 2007 17:19, Bill Davidsen wrote:
> 
>>Hugh Dickins wrote:
>>In many cases the use of O_DIRECT is purely to avoid impact on cache 
>>used by other applications. An application which writes a large quantity 
>>of data will have less impact on other applications by using O_DIRECT, 
>>assuming that the data will not be read from cache due to application 
>>pattern or the data being much larger than physical memory.
> 
> 
> But O_DIRECT is _not_ about cache. At least I think it was not about
> cache initially, it was more about DMAing data directly from/to
> application address space to/from disks, saving memcpy's and double
> allocations. Why do you think it has that special alignment requirements?
> Are they cache related? Not at all!

I don't know whether that is the case. The two issues are related -- the
IO is be done zero-copy because there is no cache involved, and due to
there being no cache, there are alignment restrictions.

I think IRIX might have implemented O_DIRECT first, and although the
semantics are a bit vague, I think it has always been to do zero copy
IO _and_ to bypass cache (ie. no splice-like tricks).

> After that people started adding unrelated semantics on it -
> "oh, we use O_DIRECT in our database code and it pushes EVERYTHING
> else out of cache. This is bad. Let's overload O_DIRECT to also mean
> 'do not pollute the cache'. Here's the patch".

It is because they already do their own caching, so going through
another, dumber, cache of same or less size (the pagecache) is useless.
fadvise does not change that.

That said, tmpfs's page are not really a cache (except when they are
swapcache, but let's not complicate things). So O_DIRECT on tmpfs
may not exactly be wrong.

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

  reply	other threads:[~2007-01-05  5:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-04 11:52 open(O_DIRECT) on a tmpfs? Michael Tokarev
2007-01-04 13:08 ` Hugh Dickins
2007-01-04 16:19   ` Bill Davidsen
2007-01-04 17:09     ` Hugh Dickins
2007-01-04 17:54       ` Peter Staubach
2007-01-04 18:11         ` Bill Davidsen
2007-01-04 18:41       ` Hua Zhong
2007-01-04 19:14         ` Hugh Dickins
2007-01-04 19:35           ` Mark Lord
2007-01-05  6:57           ` Chen, Kenneth W
2007-01-05 14:38           ` Helge Hafting
2007-01-05 14:58         ` Jesper Juhl
2007-01-05 14:59           ` Jesper Juhl
2007-01-04 22:17     ` Denis Vlasenko
2007-01-05  5:30       ` Nick Piggin [this message]
2007-01-05 16:20       ` Bill Davidsen
2007-01-06  0:30         ` Denis Vlasenko
2007-01-08 19:42           ` Bill Davidsen
2007-01-05 11:49   ` Michael Tokarev
     [not found] <7zzqw-SS-27@gated-at.bofh.it>
2007-01-04 14:47 ` Bodo Eggert

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=459DE26F.4040103@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=davidsen@tmr.com \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vda.linux@googlemail.com \
    /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.