]> xenbits.xensource.com Git - people/ssmith/nc2-2.6.27.bak/.git/commitdiff
patch blktap-ioprio.patch
authorSteven Smith <ssmith@weybridge.uk.xensource.com>
Thu, 28 May 2009 10:54:19 +0000 (11:54 +0100)
committerSteven Smith <ssmith@weybridge.uk.xensource.com>
Thu, 28 May 2009 10:54:19 +0000 (11:54 +0100)
include/linux/init_task.h
include/linux/resource.h
include/linux/sched.h
kernel/sys.c
mm/page-writeback.c

index 021d8e720c7941f17cd6a541a63b7a9275f68c9c..d998423f75286265360edd73c3456e0ceddd706b 100644 (file)
@@ -126,6 +126,7 @@ extern struct group_info init_groups;
        .lock_depth     = -1,                                           \
        .prio           = MAX_PRIO-20,                                  \
        .static_prio    = MAX_PRIO-20,                                  \
+       .special_prio   = 0,                                            \
        .normal_prio    = MAX_PRIO-20,                                  \
        .policy         = SCHED_NORMAL,                                 \
        .cpus_allowed   = CPU_MASK_ALL,                                 \
index 40fc7e62608220e9a64dd70493c3b091fa49a0b7..67177762ad20ba82c3808cfb6245d55fae0a54b6 100644 (file)
@@ -47,6 +47,7 @@ struct rlimit {
 
 #define        PRIO_MIN        (-20)
 #define        PRIO_MAX        20
+#define PRIO_SPECIAL_IO -9999
 
 #define        PRIO_PROCESS    0
 #define        PRIO_PGRP       1
index c7bba1f4a10216152848718019ec293d8e5f8ec2..7857d66c3c786ed325b747a46e9aa2dbdbce7525 100644 (file)
@@ -1056,6 +1056,8 @@ struct task_struct {
        struct hlist_head preempt_notifiers;
 #endif
 
+       int special_prio; /* XXX maybe move to struct io_context ??? */
+
        /*
         * fpu_counter contains the number of consecutive context switches
         * that the FPU is used. If this is over a threshold, the lazy fpu
index 10a263bf1b21c52420e9b5fca6cfd24ddf70e692..e968e95aa554e4461a107133d13c9dea95cee0b7 100644 (file)
@@ -121,6 +121,11 @@ static int set_one_prio(struct task_struct *p, int niceval, int error)
                error = -EPERM;
                goto out;
        }
+       if (niceval == PRIO_SPECIAL_IO) {
+               p->special_prio = PRIO_SPECIAL_IO;
+               error = 0;
+               goto out;
+       }
        if (niceval < task_nice(p) && !can_nice(p, niceval)) {
                error = -EACCES;
                goto out;
@@ -149,10 +154,15 @@ SYSCALL_DEFINE3(setpriority, int, which, int, who, int, niceval)
 
        /* normalize: avoid signed division (rounding problems) */
        error = -ESRCH;
-       if (niceval < -20)
-               niceval = -20;
-       if (niceval > 19)
-               niceval = 19;
+       if (niceval == PRIO_SPECIAL_IO) {
+               if (which != PRIO_PROCESS)
+                       return -EINVAL;
+       } else {
+               if (niceval < -20)
+                       niceval = -20;
+               if (niceval > 19)
+                       niceval = 19;
+       }
 
        read_lock(&tasklist_lock);
        switch (which) {
index c7f1573de653ad8f125a586bf6012a00225a311a..edf4c74b16346fea009841ffe5df5d93e4b7d9c3 100644 (file)
@@ -504,6 +504,8 @@ static void balance_dirty_pages(struct address_space *mapping)
                        break;
                if (pages_written >= write_chunk)
                        break;          /* We've done our duty */
+               if (current->special_prio == PRIO_SPECIAL_IO)
+                       break;          /* Exempt IO processes */
 
                congestion_wait(WRITE, HZ/10);
        }