Re: [PATCH] Change task_struct->comm to use RCU.

From: Lai Jiangshan
Date: Mon Feb 24 2014 - 20:47:28 EST


CC scheduler people.

I can't figure out what we get with this patch.

On 02/17/2014 07:27 PM, Tetsuo Handa wrote:
> Tetsuo Handa wrote:
>> This is a draft patch which changes task_struct->comm to use RCU.
>
> Changes from previous draft version:
>
> Changed "struct rcu_comm" to use copy-on-write approach. Those multi-thread
> or multi-process applications which do not change comm name will consume
> memory for only one "struct rcu_comm".
>
> Changed do_commset() not to sleep.
>
> Changed to tolerate loss of consistency when memory allocation failed.
>
> Fixed race condition in copy_process().
>
> Regards.
> ----------
>>From ada6c4d94f5afda36c7c21869d38b7111a6fe9bc Mon Sep 17 00:00:00 2001
> From: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
> Date: Mon, 17 Feb 2014 14:32:11 +0900
> Subject: [PATCH] Change task_struct->comm to use RCU.
>
> This patch changes task_struct->comm to be updated using RCU
> (unless memory allocation fails).
>
> Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
> ---
> fs/exec.c | 145 +++++++++++++++++++++++++++++++++++++++------
> include/linux/init_task.h | 4 +-
> include/linux/sched.h | 37 ++++++++++--
> kernel/fork.c | 9 +++
> kernel/kthread.c | 4 +-
> kernel/sched/core.c | 2 +-
> 6 files changed, 173 insertions(+), 28 deletions(-)
>
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index a781dec..8a68ab3 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -263,6 +263,11 @@ extern char ___assert_task_state[1 - 2*!!(
>
> /* Task command name length */
> #define TASK_COMM_LEN 16
> +struct rcu_comm {
> + char name[TASK_COMM_LEN];
> + atomic_t usage;
> + struct rcu_head rcu;
> +};
>


I think the name "rcu_comm" is not good, I suggest that s/rcu_comm/task_comm/g.

--
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/