From: Greg Kroah-Hartman Date: Wed, 17 May 2006 21:42:45 +0000 (-0700) Subject: added some bugfixes found by SGI under heavy loads X-Git-Tag: v2.6.16.17~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e5b18790fd0d95cb1a035e6a5ed146c61d90064e;p=thirdparty%2Fkernel%2Fstable-queue.git added some bugfixes found by SGI under heavy loads --- 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 index 00000000000..a832de447a5 --- /dev/null +++ b/queue-2.6.16/add-migratepage-address-space-op-to-shmem.patch @@ -0,0 +1,57 @@ +From nobody Mon Sep 17 00:00:00 2001 +From: Lee Schermerhorn +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 +Acked-by: Christoph Lameter +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + 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 + #include + #include ++#include ++ + #include + #include + #include +@@ -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 index 00000000000..fa90946b84f --- /dev/null +++ b/queue-2.6.16/page-migration-Fix-fallback-behavior-for-dirty-pages.patch @@ -0,0 +1,53 @@ +From nobody Mon Sep 17 00:00:00 2001 +From: Christoph Lameter +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 +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..a486287d9d4 --- /dev/null +++ b/queue-2.6.16/remove-cond_resched-in-gather_stats.patch @@ -0,0 +1,26 @@ +From nobody Mon Sep 17 00:00:00 2001 +From: Christoph Lameter +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 +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds + +--- + 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 diff --git a/queue-2.6.16/series b/queue-2.6.16/series index ac53b58b21f..75767d8d3c0 100644 --- a/queue-2.6.16/series +++ b/queue-2.6.16/series @@ -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