[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241018094942.GE1697@kernel.org>
Date: Fri, 18 Oct 2024 10:49:42 +0100
From: Simon Horman <horms@...nel.org>
To: Anjali Kulkarni <anjali.k.kulkarni@...cle.com>
Cc: davem@...emloft.net, Liam.Howlett@...cle.com, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, mingo@...hat.com,
peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
vschneid@...hat.com, jiri@...nulli.us, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, akpm@...ux-foundation.org, shuah@...nel.org,
linux-kselftest@...r.kernel.org, peili.io@...cle.com
Subject: Re: [PATCH net-next v5 0/3] Threads support in proc connector
On Thu, Oct 17, 2024 at 11:14:33AM -0700, Anjali Kulkarni wrote:
> Recently we committed a fix to allow processes to receive notifications for
> non-zero exits via the process connector module. Commit is a4c9a56e6a2c.
>
> However, for threads, when it does a pthread_exit(&exit_status) call, the
> kernel is not aware of the exit status with which pthread_exit is called.
> It is sent by child thread to the parent process, if it is waiting in
> pthread_join(). Hence, for a thread exiting abnormally, kernel cannot
> send notifications to any listening processes.
>
> The exception to this is if the thread is sent a signal which it has not
> handled, and dies along with it's process as a result; for eg. SIGSEGV or
> SIGKILL. In this case, kernel is aware of the non-zero exit and sends a
> notification for it.
>
> For our use case, we cannot have parent wait in pthread_join, one of the
> main reasons for this being that we do not want to track normal
> pthread_exit(), which could be a very large number. We only want to be
> notified of any abnormal exits. Hence, threads are created with
> pthread_attr_t set to PTHREAD_CREATE_DETACHED.
>
> To fix this problem, we add a new type PROC_CN_MCAST_NOTIFY to proc connector
> API, which allows a thread to send it's exit status to kernel either when
> it needs to call pthread_exit() with non-zero value to indicate some
> error or from signal handler before pthread_exit().
>
> We also need to filter packets with non-zero exit notifications futher
> based on instances, which can be identified by task names. Hence, added a
> comm field to the packet's struct proc_event, in which task->comm is
> stored.
As it seems that there will be another revision anyway,
please run this patch-set through checkpatch with the following arguments.
./scripts/checkpatch.pl --strict --max-line-length=80
And please fix warnings about alignment and line length.
But please do so in such a way that doesn't reduce readability,
e.g. don't split strings over multiple lines.
Powered by blists - more mailing lists