public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: torvalds@transmeta.com (Linus Torvalds)
To: linux-kernel@vger.kernel.org
Subject: Re: Subtle MM bug
Date: 9 Jan 2001 11:37:05 -0800	[thread overview]
Message-ID: <93fp91$26b$1@penguin.transmeta.com> (raw)
In-Reply-To: <dnbstgewoj.fsf@magla.iskon.hr> <Pine.LNX.4.10.10101091041150.2070-100000@penguin.transmeta.com> <3A5B61F7.FB0E79C1@innominate.de>

In article <3A5B61F7.FB0E79C1@innominate.de>,
Daniel Phillips  <phillips@innominate.de> wrote:
>Linus Torvalds wrote:
>> (This is why I worked so hard at getting the PageDirty semantics right in
>> the last two months or so - and why I released 2.4.0 when I did. Getting
>> PageDirty right was the big step to make all of the VM stuff possible in
>> the first place. Even if it probably looked a bit foolhardy to change the
>> semantics of "writepage()" quite radically just before 2.4 was released).
>
>On the topic of writepage, it's not symmetric with readpage at the
>moment - it still takes (struct file *).  Is this in the cleanup
>pipeline?  It looks like nfs_readpage already ignores the struct file *,
>but maybe some other net filesystems are still depending on it.

readpage() is always a synchronous operation, and is actually much more
closely linked to "prepare_write()"/"commit_write()" than to writepage,
despite the naming similarities.

So no, the two are not symmetric, and they really shouldn't be. 

"readpage()" is for reading a page into the page cache, and is always
synchronous with the reader (even prefetching is "synchronous" in the
sense that it's done by the reader: it's asynchronous in the sense that
we don't wait for the results, but the _calling_ of readpage() is
synchronous, if you see what I mean).

Similarly, prepare_write() and commit_write() are synchronous to the
writer (again, we do not wait for the writes to have actually
_happened_, but we call the functions synchronously and they can choose
to let the actual IO happen asynchronously - the VM doesn't care about
that small detail). 

So "readpage()" and "prepare_write()/commit_write()" are pairs.  They
are different simply because reading is assumed to be a cacheable and
prefetchable operation (think regular CPU caches), while writing
obviously has to give a much stricter "write _these_ bytes, not the
whole cache line". 

In contrast, writepage() is a completely different animal. It's
basically a cache eviction notice, and happens asynchronously to any
operations that actually fill or dirty the cache. So despite the name,
it really as an operation has absolutely nothing in common with
readpage(), other than the fact that it is supposed to obviously do the
IO associated with the name.

Writepage has a friend in "sync_page()", which is another asynchronous
call-back that basically says "we want you to start your IO _now_". It's
similar to "writepage()" in that it's a kind of cache state
notification: while writepage() notifies that the cached page wants to
be evicted, "sync_page()" notifies that the cached page is waited upon
by somebody else and that we want to speed up any background IO on it.

You'll notice that writepage()/sync_page() have similar calling
convention, while readpage/prepare_write/commit_write have similar
calling conventions.

The one operation that _really_ stands out is "bmap()".  It has
absolutely no calling convention at all, and is not symmetric with
anything. Pretty ugly, but easily supported.

			Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  parent reply	other threads:[~2001-01-09 19:37 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-08  5:29 Subtle MM bug Wayne Whitney
2001-01-08  5:42 ` Andi Kleen
2001-01-08  6:04   ` Linus Torvalds
2001-01-08 17:44     ` Rik van Riel
2001-01-08 18:02       ` Linus Torvalds
2001-01-08 17:16 ` Rik van Riel
2001-01-08 17:58   ` Linus Torvalds
2001-01-08 23:41     ` Zlatko Calusic
2001-01-09  2:58       ` Linus Torvalds
2001-01-09  6:20       ` Eric W. Biederman
2001-01-09  7:27         ` Linus Torvalds
2001-01-09 11:38           ` Eric W. Biederman
2001-01-09 12:29           ` Zlatko Calusic
2001-01-09 18:47             ` Linus Torvalds
2001-01-09 19:09               ` Daniel Phillips
2001-01-09 19:29                 ` Trond Myklebust
2001-01-10 17:32                   ` Andi Kleen
2001-01-10 19:31                     ` Alan Cox
2001-01-10 19:33                       ` Andi Kleen
2001-01-10 19:40                         ` Alan Cox
2001-01-10 19:43                           ` Andi Kleen
2001-01-10 19:48                             ` Alan Cox
2001-01-10 19:48                               ` Andi Kleen
2001-01-11  9:51                               ` Trond Myklebust
2001-01-10 20:11                       ` Linus Torvalds
2001-01-11 12:56                         ` Stephen C. Tweedie
2001-01-11 13:10                           ` Andi Kleen
2001-01-11 13:12                           ` Trond Myklebust
2001-01-11 14:13                             ` Stephen C. Tweedie
2001-01-11 19:03                               ` Alexander Viro
2001-01-11 19:47                                 ` Stephen C. Tweedie
2001-01-11 19:57                                   ` Alexander Viro
2001-01-11 16:50                           ` Albert D. Cahalan
2001-01-11 17:35                             ` Stephen C. Tweedie
2001-01-11 19:38                               ` Albert D. Cahalan
2001-01-11 19:01                           ` Alexander Viro
2001-01-09 19:37                 ` Linus Torvalds [this message]
2001-01-17  8:46                 ` Rik van Riel
2001-01-25 22:51                   ` Daniel Phillips
2001-01-09 19:53               ` Simon Kirby
2001-01-09 20:08                 ` Linus Torvalds
2001-01-09 20:10                 ` Zlatko Calusic
2001-01-10  1:45               ` David Woodhouse
2001-01-10  2:26                 ` Andrea Arcangeli
2001-01-10  6:57                 ` Linus Torvalds
2001-01-10 11:46                   ` David Woodhouse
2001-01-10 14:56                     ` Andrea Arcangeli
2001-01-10 17:46                       ` Eric W. Biederman
2001-01-10 18:33                         ` Andrea Arcangeli
2001-01-17 14:26                           ` Rik van Riel
2001-01-10 19:03                         ` Linus Torvalds
2001-01-10 19:27                           ` David S. Miller
2001-01-10 19:36                           ` Alan Cox
2001-01-10 23:56                             ` David Weinehall
2001-01-11  0:24                               ` Alan Cox
2001-01-12  5:56                               ` Ralf Baechle
2001-01-12 16:10                                 ` Eric W. Biederman
2001-01-12 21:11                                   ` Russell King
2001-01-15  2:56                                     ` Ralf Baechle
2001-01-15  6:59                                       ` Eric W. Biederman
2001-01-15  2:53                                   ` Ralf Baechle
2001-01-15  8:41                                     ` Caches, page coloring, virtual indexed caches, and more Eric W. Biederman
2001-01-15 11:54                                       ` Ralf Baechle
2001-01-15 12:53                                         ` Anton Blanchard
2001-01-15 17:41                                           ` Ralf Baechle
2001-01-17  4:36                                             ` Anton Blanchard
2001-01-16  9:34                                           ` Eric W. Biederman
2001-01-17  4:43                                             ` Anton Blanchard
2001-01-17  8:35                                               ` Eric W. Biederman
2001-01-15 17:16                                         ` Eric W. Biederman
2001-01-16  4:58                                           ` Ralf Baechle
2001-01-15 18:22                                         ` Jamie Lokier
2001-01-15 12:51                                       ` Anton Blanchard
2001-01-17 14:28                           ` Subtle MM bug Rik van Riel
2001-01-18  1:23                             ` Linus Torvalds
2001-01-18 11:48                               ` Rik van Riel
2001-01-10 17:03                     ` Linus Torvalds
2001-01-11 14:36                       ` Jim Gettys
2001-01-08 21:30   ` Wayne Whitney
  -- strict thread matches above, loose matches on Subject: below --
2001-01-10 19:57 Chris Wing
2001-01-08 20:39 Szabolcs Szakacsits
2001-01-08 21:56 ` Wayne Whitney
2001-01-08 23:22   ` Wayne Whitney
2001-01-08 23:30     ` Andrea Arcangeli
2001-01-09  0:37       ` Linus Torvalds
2001-01-08 22:00 ` Wayne Whitney
2001-01-08 22:15   ` Andrea Arcangeli
2001-01-07 20:59 Zlatko Calusic
2001-01-07 21:37 ` Rik van Riel
2001-01-07 22:33   ` Zlatko Calusic
2001-01-09  2:01   ` Zlatko Calusic
2001-01-17  4:48     ` Rik van Riel
2001-01-17 18:53       ` Zlatko Calusic
2001-01-18  1:32         ` Rik van Riel
2001-04-17 19:37           ` H. Peter Anvin

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='93fp91$26b$1@penguin.transmeta.com' \
    --to=torvalds@transmeta.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox