lkml.org 
[lkml]   [2005]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [ckrm-tech] [patch 07/38] CKRM e18: Numtasks Controller
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(&current->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(&current->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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-06-28 08:36    [W:0.235 / U:12.256 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site