Re: [PATCH 1/4] copy_signal cleanup: use zalloc and removeinitializations

From: Oleg Nesterov
Date: Wed Dec 02 2009 - 09:04:56 EST


On 12/01, Veaceslav Falico wrote:
>
> Use kmem_cache_zalloc() on signal creation and remove unneeded initialization
> lines.

I like this series very much. Not only it cleanups and lessens the code,
it opens the possibility to do more cleanups. Say, we can simplify
exit_notify() a bit, we can remove ->group_exit_task check since we know
->notify_count < 0 can be false positive.

A couple of nits though,

> Signed-off-by: Veaceslav Falico <vfalico@xxxxxxxxxx>
> ---
>
> diff --git a/kernel/fork.c b/kernel/fork.c
> index 166b8c4..160477d 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -825,17 +825,6 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig)
> /* Thread group counters. */
> thread_group_cputime_init(sig);
>
> - /* Expiration times and increments. */
> - sig->it[CPUCLOCK_PROF].expires = cputime_zero;
> - sig->it[CPUCLOCK_PROF].incr = cputime_zero;
> - sig->it[CPUCLOCK_VIRT].expires = cputime_zero;
> - sig->it[CPUCLOCK_VIRT].incr = cputime_zero;
> -
> - /* Cached expiration times. */
> - sig->cputime_expires.prof_exp = cputime_zero;
> - sig->cputime_expires.virt_exp = cputime_zero;
> - sig->cputime_expires.sched_exp = 0;
> -
> if (sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) {
> sig->cputime_expires.prof_exp =
> secs_to_cputime(sig->rlim[RLIMIT_CPU].rlim_cur);

Personally I don't mind, but perhaps it is better to move this change
into 3/4 which changes thread_group_cputime_init().

> @@ -855,7 +844,7 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
> if (clone_flags & CLONE_THREAD)
> return 0;
>
> - sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
> + sig = kmem_cache_zalloc(signal_cachep, GFP_KERNEL);
>
> [...snip...]

Imho, very nice change.

Oleg.

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