[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191203064132.38d75348@lwn.net>
Date: Tue, 3 Dec 2019 06:41:32 -0700
From: Jonathan Corbet <corbet@....net>
To: Amol Grover <frextrite@...il.com>
Cc: "Paul E . McKenney" <paulmck@...nel.org>,
Josh Triplett <josh@...htriplett.org>,
Steven Rostedt <rostedt@...dmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Lai Jiangshan <jiangshanlai@...il.com>,
Joel Fernandes <joel@...lfernandes.org>, rcu@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
Shuah Khan <skhan@...uxfoundation.org>,
Madhuparna Bhowmik <madhuparnabhowmik04@...il.com>
Subject: Re: [PATCH] doc: listRCU: Add some more listRCU patterns in the
kernel
On Tue, 3 Dec 2019 12:09:43 +0530
Amol Grover <frextrite@...il.com> wrote:
> - Add more information about listRCU patterns taking examples
> from audit subsystem in the linux kernel.
>
> - The initially written audit examples are kept, even though they are
> slightly different in the kernel.
>
> - Modify inline text for better passage quality.
>
> - Fix typo in code-blocks and improve code comments.
>
> - Add text formatting (italics, bold and code) for better emphasis.
Thanks for improving the documentation! I'll leave the RCU stuff to the
experts, but I do have one request...
[...]
> +When a process exits, ``release_task()`` calls ``list_del_rcu(&p->tasks)`` under
> +``tasklist_lock`` writer lock protection, to remove the task from the list of
> +all tasks. The ``tasklist_lock`` prevents concurrent list additions/removals
> +from corrupting the list. Readers using ``for_each_process()`` are not protected
> +with the ``tasklist_lock``. To prevent readers from noticing changes in the list
> +pointers, the ``task_struct`` object is freed only after one or more grace
> +periods elapse (with the help of ``call_rcu()``). This deferring of destruction
> +ensures that any readers traversing the list will see valid ``p->tasks.next``
> +pointers and deletion/freeing can happen in parallel with traversal of the list.
> +This pattern is also called an **existence lock**, since RCU pins the object in
> +memory until all existing readers finish.
Please don't put function names as literal text. If you just say
call_rcu(), it will be formatted correctly and cross-linked to the
appropriate kerneldoc entry. Saying ``call_rcu()`` defeats that and
clutters the plain-text reading experience.
Thanks,
jon
Powered by blists - more mailing lists