Gerrit Huizenga wrote:
> Index: linux-2.6.12-ckrm1/kernel/fork.c
> ===================================================================
> --- linux-2.6.12-ckrm1.orig/kernel/fork.c 2005-06-20 13:08:27.000000000
> -0700
> +++ linux-2.6.12-ckrm1/kernel/fork.c 2005-06-20 13:08:34.000000000 -0700
> @@ -42,6 +42,8 @@
> #include <linux/rmap.h>
> #include <linux/acct.h>
> #include <linux/ckrm_events.h>
> +#include <linux/ckrm_tsk.h>
> +#include <linux/ckrm_tc.h>
>
> #include <asm/pgtable.h>
> #include <asm/pgalloc.h>
> @@ -1211,6 +1213,9 @@ long do_fork(unsigned long clone_flags,
> clone_flags |= CLONE_PTRACE;
> }
>
> + if (numtasks_get_ref(¤t->taskclass->core, 0) == 0) {
> + return -ENOMEM;
> + }
> p = copy_process(clone_flags, stack_start, regs, stack_size,
> parent_tidptr, child_tidptr, pid);
> /*
> * Do this prior waking up the new thread - the thread pointer
> @@ -1250,6 +1255,7 @@ long do_fork(unsigned long clone_flags,
> ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) |
> SIGTRAP);
> }
> } else {
> + numtasks_put_ref(¤t->taskclass->core);
> free_pidmap(pid);
> pid = PTR_ERR(p);
> }
Instead of returning -ENOMEM on fork fail due to numtask or forkrate
limit, I'd rather prefer returning -EAGAIN.
Because, according to IEEE Std 1003.1, if fork() fails due to
reaching limit, it shall set the errno to EAGAIN.
Thanks,
MAEDA Naoaki
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
ckrm-tech mailing list
https://lists.sourceforge.net/lists/listinfo/ckrm-tech