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

[Xen-devel] [PATCH 6/12] Make kthreads freezable


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Tue, 15 May 2007 22:18:56 +0800
  • Delivery-date: Tue, 15 May 2007 07:17:35 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AceW+/jdOuVxAehxSYa7EsCSeV9Chg==
  • Thread-topic: [PATCH 6/12] Make kthreads freezable

Kernel threads need to be aware of freeze request, by
checking in each loop. xenbus/xenwatch threads are bit
special with PF_NOFREEZE, since we're sure that they
do nothing to block other native device drivers.

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

diff -r 26f7f5045ddd linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Tue Apr
10 12:46:03 2007 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Tue Apr
10 12:46:34 2007 -0400
@@ -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 26f7f5045ddd linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Tue Apr
10 12:46:03 2007 -0400
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Tue Apr
10 12:46:34 2007 -0400
@@ -718,6 +718,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));
@@ -836,6 +837,7 @@ static int xenbus_thread(void *unused)
 {
        int err;
 
+       current->flags |= PF_NOFREEZE;
        for (;;) {
                err = process_msg();
                if (err)

Attachment: make_kthread_freezable.patch
Description: make_kthread_freezable.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®.