public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [patch 4/10] decouple swapper_space treatment from other address_spaces
Date: Sun, 05 May 2002 13:55:21 -0700	[thread overview]
Message-ID: <3CD59C39.68FB7E3E@zip.com.au> (raw)



swapper_space is different.  Its pages are locked during writeout, it
uses PAGE_SIZE rather than PAGE_CACHE_SIZE.  Converting swap to look
more like the other address_spaces is a separate project.  This patch
fully restores the old swap behaviour.

- Don't dirty swapcache page buffers in set_page_dirty().

  Fixes a problem where __free_pte() runs set_page_dirty() and then
  immediately runs ClearPageDirty().  The pages ends up clean, with
  dirty buffers, and is unfreeable.

- Hence, don't mark the page clean if its buffers are clean - swap
  does not have page/buffers dirty state coherency.


=====================================

--- 2.5.13/mm/page-writeback.c~clean-swap-page	Sun May  5 13:32:00 2002
+++ 2.5.13-akpm/mm/page-writeback.c	Sun May  5 13:32:36 2002
@@ -454,6 +454,9 @@ EXPORT_SYMBOL(write_one_page);
  *
  * FIXME: may need to call ->reservepage here as well.  That's rather up to the
  * address_space though.
+ *
+ * For now, we treat swapper_space specially.  It doesn't use the normal
+ * block a_ops.
  */
 int __set_page_dirty_buffers(struct page *page)
 {
@@ -470,7 +473,7 @@ int __set_page_dirty_buffers(struct page
 
 	spin_lock(&inode->i_bufferlist_lock);
 
-	if (page_has_buffers(page)) {
+	if (page_has_buffers(page) && !PageSwapCache(page)) {
 		struct buffer_head *head = page_buffers(page);
 		struct buffer_head *bh = head;
 
--- 2.5.13/fs/buffer.c~clean-swap-page	Sun May  5 13:32:00 2002
+++ 2.5.13-akpm/fs/buffer.c	Sun May  5 13:32:36 2002
@@ -2159,14 +2159,6 @@ static void check_ttfb_buffer(struct pag
  * total exclusion from __set_page_dirty_buffers().  That is obtained with
  * i_bufferlist_lock.
  *
- * Nobody should be calling try_to_free_buffers against a page which is
- * eligible for set_page_dirty() treatment anyway - the page is clearly
- * not freeable.  So we could just test page_count(page) here and complain
- * then scram if it's wrong.
- *
- * If any buffer is not uptodate then the entire page is set not uptodate,
- * as the partial uptodateness information is about to be lost.
- *
  * try_to_free_buffers() is non-blocking.
  */
 static inline int buffer_busy(struct buffer_head *bh)
@@ -2222,8 +2214,17 @@ int try_to_free_buffers(struct page *pag
 	inode = page->mapping->host;
 	spin_lock(&inode->i_bufferlist_lock);
 	ret = drop_buffers(page);
-	if (ret)
+	if (ret && !PageSwapCache(page)) {
+		/*
+		 * If the filesystem writes its buffers by hand (eg ext3)
+		 * then we can have clean buffers against a dirty page.  We
+		 * clean the page here; otherwise later reattachment of buffers
+		 * could encounter a non-uptodate page, which is unresolvable.
+		 * This only applies in the rare case where try_to_free_buffers
+		 * succeeds but the page is not freed.
+		 */
 		ClearPageDirty(page);
+	}
 	spin_unlock(&inode->i_bufferlist_lock);
 	return ret;
 }


-

                 reply	other threads:[~2002-05-05 20:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3CD59C39.68FB7E3E@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox