[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/6] Make kernel threads freezable


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Tue, 6 Feb 2007 16:13:50 +0800
  • Delivery-date: Tue, 06 Feb 2007 00:13:39 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcdJxrsC4+UDDWtYScSnuv4PyBroqg==
  • Thread-topic: [PATCH 1/6] Make kernel threads freezable

Make kthreads freezable. Two exceptions are xenbus and
xenwatch threads, which are required later at xenbus_
suspend(). Since we know them two nothing to do with
physical devices, mark them nofreeze safely.

Signed-off-by Ke Yu <ke.yu@xxxxxxxxx>
Signed-off-by Kevin Tian <kevin.tian@xxxxxxxxx>

diff -r a26a063eabd0 -r eeff197b56e4
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Mon Feb
05 16:57:35 2007 +0800
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Mon Feb
05 16:57:58 2007 +0800
@@ -208,6 +208,9 @@ int blkif_schedule(void *arg)
                printk(KERN_DEBUG "%s: started\n", current->comm);
 
        while (!kthread_should_stop()) {
+               if(try_to_freeze())
+                       continue;
+            
                wait_event_interruptible(
                        blkif->wq,
                        blkif->waiting_reqs || kthread_should_stop());
diff -r a26a063eabd0 -r eeff197b56e4
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Mon Feb
05 16:57:35 2007 +0800
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Mon Feb
05 16:57:58 2007 +0800
@@ -717,6 +717,7 @@ static int xenwatch_thread(void *unused)
        struct list_head *ent;
        struct xs_stored_msg *msg;
 
+       current->flags |= PF_NOFREEZE;
        for (;;) {
                wait_event_interruptible(watch_events_waitq,
                                         !list_empty(&watch_events));
@@ -813,6 +814,7 @@ static int xenbus_thread(void *unused)
 {
        int err;
 
+       current->flags |= PF_NOFREEZE;
        for (;;) {
                err = process_msg();
                if (err)

Attachment: make_kthread_freeze_aware.patch
Description: make_kthread_freeze_aware.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.