pids: fix fork_idle() to setup ->pids correctly
[safe/jmp/linux-2.6] / kernel / res_counter.c
index bf8e753..c7eaa37 100644 (file)
@@ -10,7 +10,6 @@
 #include <linux/types.h>
 #include <linux/parser.h>
 #include <linux/fs.h>
-#include <linux/slab.h>
 #include <linux/res_counter.h>
 #include <linux/uaccess.h>
 #include <linux/mm.h>
@@ -18,7 +17,8 @@
 void res_counter_init(struct res_counter *counter, struct res_counter *parent)
 {
        spin_lock_init(&counter->lock);
-       counter->limit = (unsigned long long)LLONG_MAX;
+       counter->limit = RESOURCE_MAX;
+       counter->soft_limit = RESOURCE_MAX;
        counter->parent = parent;
 }
 
@@ -101,6 +101,8 @@ res_counter_member(struct res_counter *counter, int member)
                return &counter->limit;
        case RES_FAILCNT:
                return &counter->failcnt;
+       case RES_SOFT_LIMIT:
+               return &counter->soft_limit;
        };
 
        BUG();
@@ -133,6 +135,16 @@ int res_counter_memparse_write_strategy(const char *buf,
                                        unsigned long long *res)
 {
        char *end;
+
+       /* return RESOURCE_MAX(unlimited) if "-1" is specified */
+       if (*buf == '-') {
+               *res = simple_strtoull(buf + 1, &end, 10);
+               if (*res != 1 || *end != '\0')
+                       return -EINVAL;
+               *res = RESOURCE_MAX;
+               return 0;
+       }
+
        /* FIXME - make memparse() take const char* args */
        *res = memparse((char *)buf, &end);
        if (*end != '\0')