Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 3160499aacb81f6735941eb4c372d87a > files > 154

kvm-83-164.el5_5.30.src.rpm

From 69aacebc5997494923b0247abf01bbbf784ad67a Mon Sep 17 00:00:00 2001
From: Andrea Arcangeli <aarcange@redhat.com>
Date: Tue, 23 Jun 2009 18:16:10 +0200
Subject: [PATCH] KSM suspend fix

Can somebody with a laptop with functional suspend to ram test the
below? This was reported on #kvm on irc. Against kvm-userland-rhel5.

------
this add try_to_freeze() call to the ksm thread control function to
allow suspend.

Signed-off-by: Chris Wright <chrisw@redhat.com>
Signed-off-by: Izik Eidus <ieidus@redhat.com>
Message-ID: <20090623161610.GA4379@random.random>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Bugzilla: 505440
RH-Upstream-status: pending
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
---
 kernel/ksm/ksm_main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/ksm/ksm_main.c b/kernel/ksm/ksm_main.c
index 0878613..7032b4f 100644
--- a/kernel/ksm/ksm_main.c
+++ b/kernel/ksm/ksm_main.c
@@ -1108,7 +1108,7 @@ static int ksm_scan_start(struct ksm_scan *ksm_scan, int scan_npages)
 
 	scan_update_old_index(ksm_scan);
 
-	while (scan_npages > 0) {
+	while (scan_npages > 0 && likely(!freezing(current))) {
 		ret = scan_get_next_index(ksm_scan, 1);
 		if (ret)
 			goto out;
@@ -1368,6 +1368,7 @@ int kthread_ksm_scan_thread(void *nothing)
 			wait_event_interruptible(kthread_wait,
 					ksmd_flags & ksm_control_flags_run ||
 					kthread_should_stop());
+		try_to_freeze();
 	}
 	return 0;
 }
-- 
1.6.3.rc4.29.g8146