Re: [PATCH net-next v1 1/3] connector/cn_proc: Add hash table for threads

From: Anjali Kulkarni
Date: Mon Oct 14 2024 - 11:54:23 EST




On 10/14/24, 1:28 AM, "Peter Zijlstra" <peterz@xxxxxxxxxxxxx <mailto:peterz@xxxxxxxxxxxxx>> wrote:


On Sun, Oct 13, 2024 at 10:06:15AM -0700, Anjali Kulkarni wrote:


> + if (unlikely(task->flags & PF_EXIT_NOTIFY)) {
> + task_lock(task);
> + task->flags &= ~PF_EXIT_NOTIFY;
> + task_unlock(task);
> +


> @@ -413,6 +440,15 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg,
> if (msg->len == sizeof(*pinput)) {
> pinput = (struct proc_input *)msg->data;
> mc_op = pinput->mcast_op;
> + if (mc_op == PROC_CN_MCAST_NOTIFY) {
> + pr_debug("%s: Received PROC_CN_MCAST_NOTIFY, pid %d\n",
> + __func__, current->pid);
> + task_lock(current);
> + current->flags |= PF_EXIT_NOTIFY;
> + task_unlock(current);
> + err = cn_add_elem(pinput->uexit_code, current->pid);
> + return;
> + }


You seem to think that task_lock protects task->flags ? Why?

ANJALI> Missed this earlier, but it should actually not be needed, as both paths which modify the flags are via a syscall? I will go ahead and remove the locking, and send out in my next revision (if I missed anything let me know).