]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
added some bugfixes found by SGI under heavy loads
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 17 May 2006 21:42:45 +0000 (14:42 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 17 May 2006 21:42:45 +0000 (14:42 -0700)
queue-2.6.16/add-migratepage-address-space-op-to-shmem.patch [new file with mode: 0644]
queue-2.6.16/page-migration-Fix-fallback-behavior-for-dirty-pages.patch [new file with mode: 0644]
queue-2.6.16/remove-cond_resched-in-gather_stats.patch [new file with mode: 0644]
queue-2.6.16/series

diff --git a/queue-2.6.16/add-migratepage-address-space-op-to-shmem.patch b/queue-2.6.16/add-migratepage-address-space-op-to-shmem.patch
new file mode 100644 (file)
index 0000000..a832de4
--- /dev/null
@@ -0,0 +1,57 @@
+From nobody Mon Sep 17 00:00:00 2001
+From: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
+Date: Sat, 22 Apr 2006 02:35:48 -0700
+Subject: [PATCH] add migratepage address space op to shmem
+
+Basic problem: pages of a shared memory segment can only be migrated once.
+
+In 2.6.16 through 2.6.17-rc1, shared memory mappings do not have a
+migratepage address space op.  Therefore, migrate_pages() falls back to
+default processing.  In this path, it will try to pageout() dirty pages.
+Once a shared memory page has been migrated it becomes dirty, so
+migrate_pages() will try to page it out.  However, because the page count
+is 3 [cache + current + pte], pageout() will return PAGE_KEEP because
+is_page_cache_freeable() returns false.  This will abort all subsequent
+migrations.
+
+This patch adds a migratepage address space op to shared memory segments to
+avoid taking the default path.  We use the "migrate_page()" function
+because it knows how to migrate dirty pages.  This allows shared memory
+segment pages to migrate, subject to other conditions such as # pte's
+referencing the page [page_mapcount(page)], when requested.
+
+I think this is safe.  If we're migrating a shared memory page, then we
+found the page via a page table, so it must be in memory.
+
+Can be verified with memtoy and the shmem-mbind-test script, both
+available at:  http://free.linux.hp.com/~lts/Tools/
+
+Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
+Acked-by: Christoph Lameter <clameter@sgi.com>
+Signed-off-by: Andrew Morton <akpm@osdl.org>
+Signed-off-by: Linus Torvalds <torvalds@osdl.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ mm/shmem.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- linux-2.6.16.16.orig/mm/shmem.c
++++ linux-2.6.16.16/mm/shmem.c
+@@ -46,6 +46,8 @@
+ #include <linux/mempolicy.h>
+ #include <linux/namei.h>
+ #include <linux/ctype.h>
++#include <linux/migrate.h>
++
+ #include <asm/uaccess.h>
+ #include <asm/div64.h>
+ #include <asm/pgtable.h>
+@@ -2172,6 +2174,7 @@ static struct address_space_operations s
+       .prepare_write  = shmem_prepare_write,
+       .commit_write   = simple_commit_write,
+ #endif
++      .migratepage    = migrate_page,
+ };
+ static struct file_operations shmem_file_operations = {
diff --git a/queue-2.6.16/page-migration-Fix-fallback-behavior-for-dirty-pages.patch b/queue-2.6.16/page-migration-Fix-fallback-behavior-for-dirty-pages.patch
new file mode 100644 (file)
index 0000000..fa90946
--- /dev/null
@@ -0,0 +1,53 @@
+From nobody Mon Sep 17 00:00:00 2001
+From: Christoph Lameter <clameter@sgi.com>
+Date: Mon, 1 May 2006 12:16:08 -0700
+Subject: [PATCH] page migration: Fix fallback behavior for dirty pages
+
+Currently we check PageDirty() in order to make the decision to swap out
+the page.  However, the dirty information may be only be contained in the
+ptes pointing to the page.  We need to first unmap the ptes before checking
+for PageDirty().  If unmap is successful then the page count of the page
+will also be decreased so that pageout() works properly.
+
+This is a fix necessary for 2.6.17.  Without this fix we may migrate dirty
+pages for filesystems without migration functions.  Filesystems may keep
+pointers to dirty pages.  Migration of dirty pages can result in the
+filesystem keeping pointers to freed pages.
+
+Unmapping is currently not be separated out from removing all the
+references to a page and moving the mapping.  Therefore try_to_unmap will
+be called again in migrate_page() if the writeout is successful.  However,
+it wont do anything since the ptes are already removed.
+
+The coming updates to the page migration code will restructure the code
+so that this is no longer necessary.
+
+Signed-off-by: Christoph Lameter <clameter@sgi.com>
+Signed-off-by: Andrew Morton <akpm@osdl.org>
+Signed-off-by: Linus Torvalds <torvalds@osdl.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ mm/vmscan.c |   11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+--- linux-2.6.16.16.orig/mm/vmscan.c
++++ linux-2.6.16.16/mm/vmscan.c
+@@ -949,6 +949,17 @@ redo:
+                       goto unlock_both;
+                 }
++              /* Make sure the dirty bit is up to date */
++              if (try_to_unmap(page, 1) == SWAP_FAIL) {
++                      rc = -EPERM;
++                      goto unlock_both;
++              }
++
++              if (page_mapcount(page)) {
++                      rc = -EAGAIN;
++                      goto unlock_both;
++              }
++
+               /*
+                * Default handling if a filesystem does not provide
+                * a migration function. We can only migrate clean
diff --git a/queue-2.6.16/remove-cond_resched-in-gather_stats.patch b/queue-2.6.16/remove-cond_resched-in-gather_stats.patch
new file mode 100644 (file)
index 0000000..a486287
--- /dev/null
@@ -0,0 +1,26 @@
+From nobody Mon Sep 17 00:00:00 2001
+From: Christoph Lameter <clameter@sgi.com>
+Date: Thu, 20 Apr 2006 02:43:12 -0700
+Subject: [PATCH] Remove cond_resched in gather_stats()
+
+gather_stats() is called with a spinlock held from check_pte_range.  We
+cannot reschedule with a lock held.
+
+Signed-off-by: Christoph Lameter <clameter@sgi.com>
+Signed-off-by: Andrew Morton <akpm@osdl.org>
+Signed-off-by: Linus Torvalds <torvalds@osdl.org>
+
+---
+ mm/mempolicy.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- linux-2.6.16.16.orig/mm/mempolicy.c
++++ linux-2.6.16.16/mm/mempolicy.c
+@@ -1796,7 +1796,6 @@ static void gather_stats(struct page *pa
+               md->mapcount_max = count;
+       md->node[page_to_nid(page)]++;
+-      cond_resched();
+ }
+ #ifdef CONFIG_HUGETLB_PAGE
index ac53b58b21ff08068519f87d6e469d2b1335ce8d..75767d8d3c00ad71395182e9da582c8a336a387b 100644 (file)
@@ -15,3 +15,6 @@ Cardman-40x0-Fix-udev-device-creation.patch
 PCI-quirk-VIA-IRQ-fixup-should-only-run-for-VIA-southbridges.patch
 PCI-VIA-quirk-fixup-additional-PCI-IDs.patch
 i386-x86_64-Force-pci-noacpi-on-HP-XW9300.patch
+remove-cond_resched-in-gather_stats.patch
+add-migratepage-address-space-op-to-shmem.patch
+page-migration-Fix-fallback-behavior-for-dirty-pages.patch