--- /dev/null
+From e48982734ea0500d1eba4f9d96195acc5406cad6 Mon Sep 17 00:00:00 2001
+From: Michal Hocko <mhocko@suse.cz>
+Date: Tue, 29 May 2012 15:06:45 -0700
+Subject: mm: consider all swapped back pages in used-once logic
+
+From: Michal Hocko <mhocko@suse.cz>
+
+commit e48982734ea0500d1eba4f9d96195acc5406cad6 upstream.
+
+Commit 645747462435 ("vmscan: detect mapped file pages used only once")
+made mapped pages have another round in inactive list because they might
+be just short lived and so we could consider them again next time. This
+heuristic helps to reduce pressure on the active list with a streaming
+IO worklods.
+
+This patch fixes a regression introduced by this commit for heavy shmem
+based workloads because unlike Anon pages, which are excluded from this
+heuristic because they are usually long lived, shmem pages are handled
+as a regular page cache.
+
+This doesn't work quite well, unfortunately, if the workload is mostly
+backed by shmem (in memory database sitting on 80% of memory) with a
+streaming IO in the background (backup - up to 20% of memory). Anon
+inactive list is full of (dirty) shmem pages when watermarks are hit.
+Shmem pages are kept in the inactive list (they are referenced) in the
+first round and it is hard to reclaim anything else so we reach lower
+scanning priorities very quickly which leads to an excessive swap out.
+
+Let's fix this by excluding all swap backed pages (they tend to be long
+lived wrt. the regular page cache anyway) from used-once heuristic and
+rather activate them if they are referenced.
+
+The customer's workload is shmem backed database (80% of RAM) and they
+are measuring transactions/s with an IO in the background (20%).
+Transactions touch more or less random rows in the table. The
+transaction rate fell by a factor of 3 (in the worst case) because of
+commit 64574746. This patch restores the previous numbers.
+
+Signed-off-by: Michal Hocko <mhocko@suse.cz>
+Acked-by: Johannes Weiner <hannes@cmpxchg.org>
+Cc: Mel Gorman <mel@csn.ul.ie>
+Cc: Minchan Kim <minchan@kernel.org>
+Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
+Reviewed-by: Rik van Riel <riel@redhat.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/vmscan.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/mm/vmscan.c
++++ b/mm/vmscan.c
+@@ -665,7 +665,7 @@ static enum page_references page_check_r
+ return PAGEREF_RECLAIM;
+
+ if (referenced_ptes) {
+- if (PageAnon(page))
++ if (PageSwapBacked(page))
+ return PAGEREF_ACTIVATE;
+ /*
+ * All mapped pages start out with page table
--- /dev/null
+From b7e94a1686c5daef4f649f7f4f839cc294f07710 Mon Sep 17 00:00:00 2001
+From: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
+Date: Tue, 22 May 2012 18:57:17 +0900
+Subject: SCSI: Fix dm-multipath starvation when scsi host is busy
+
+From: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
+
+commit b7e94a1686c5daef4f649f7f4f839cc294f07710 upstream.
+
+block congestion control doesn't have any concept of fairness across
+multiple queues. This means that if SCSI reports the host as busy in
+the queue congestion control it can result in an unfair starvation
+situation in dm-mp if there are multiple multipath devices on the same
+host. For example:
+http://www.redhat.com/archives/dm-devel/2012-May/msg00123.html
+
+The fix for this is to report only the sdev busy state (and ignore the
+host busy state) in the block congestion control call back.
+The host is still congested, but the SCSI subsystem will sort out the
+congestion in a fair way because it knows the relation between the
+queues and the host.
+
+[jejb: fixed up trailing whitespace]
+Reported-by: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
+Tested-by: Bernd Schubert <bernd.schubert@itwm.fraunhofer.de>
+Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
+Signed-off-by: James Bottomley <JBottomley@Parallels.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/scsi_lib.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+--- a/drivers/scsi/scsi_lib.c
++++ b/drivers/scsi/scsi_lib.c
+@@ -1380,16 +1380,19 @@ static int scsi_lld_busy(struct request_
+ {
+ struct scsi_device *sdev = q->queuedata;
+ struct Scsi_Host *shost;
+- struct scsi_target *starget;
+
+ if (!sdev)
+ return 0;
+
+ shost = sdev->host;
+- starget = scsi_target(sdev);
+
+- if (scsi_host_in_recovery(shost) || scsi_host_is_busy(shost) ||
+- scsi_target_is_busy(starget) || scsi_device_is_busy(sdev))
++ /*
++ * Ignore host/starget busy state.
++ * Since block layer does not have a concept of fairness across
++ * multiple queues, congestion of host/starget needs to be handled
++ * in SCSI layer.
++ */
++ if (scsi_host_in_recovery(shost) || scsi_device_is_busy(sdev))
+ return 1;
+
+ return 0;
--- /dev/null
+From 1ff2f40305772b159a91c19590ee159d3a504afc Mon Sep 17 00:00:00 2001
+From: James Bottomley <jbottomley@parallels.com>
+Date: Wed, 30 May 2012 09:45:39 +0000
+Subject: SCSI: fix scsi_wait_scan
+
+From: James Bottomley <jbottomley@parallels.com>
+
+commit 1ff2f40305772b159a91c19590ee159d3a504afc upstream.
+
+Commit c751085943362143f84346d274e0011419c84202
+Author: Rafael J. Wysocki <rjw@sisk.pl>
+Date: Sun Apr 12 20:06:56 2009 +0200
+
+ PM/Hibernate: Wait for SCSI devices scan to complete during resume
+
+Broke the scsi_wait_scan module in 2.6.30. Apparently debian still uses it so
+fix it and backport to stable before removing it in 3.6.
+
+The breakage is caused because the function template in
+include/scsi/scsi_scan.h is defined to be a nop unless SCSI is built in.
+That means that in the modular case (which is every distro), the
+scsi_wait_scan module does a simple async_synchronize_full() instead of
+waiting for scans.
+
+Signed-off-by: James Bottomley <JBottomley@Parallels.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/scsi_wait_scan.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/scsi/scsi_wait_scan.c
++++ b/drivers/scsi/scsi_wait_scan.c
+@@ -12,7 +12,7 @@
+
+ #include <linux/module.h>
+ #include <linux/device.h>
+-#include <scsi/scsi_scan.h>
++#include "scsi_priv.h"
+
+ static int __init wait_scan_init(void)
+ {
--- /dev/null
+scsi-fix-scsi_wait_scan.patch
+scsi-fix-dm-multipath-starvation-when-scsi-host-is-busy.patch
+mm-consider-all-swapped-back-pages-in-used-once-logic.patch