[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c7cee2d4-5bbd-4867-ac12-a0a2f73f6c44@gmail.com>
Date: Sat, 7 Dec 2024 13:24:00 +0900
From: Akira Yokosawa <akiyks@...il.com>
To: rdunlap@...radead.org, surenb@...gle.com
Cc: akpm@...ux-foundation.org, brauner@...nel.org, corbet@....net,
dave@...olabs.net, david@...hat.com, dhowells@...hat.com,
hannes@...xchg.org, hdanton@...a.com, hughd@...gle.com, jannh@...gle.com,
kernel-team@...roid.com, liam.howlett@...cle.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
lorenzo.stoakes@...cle.com, mgorman@...hsingularity.net, mhocko@...e.com,
minchan@...gle.com, mjguzik@...il.com, oleg@...hat.com,
oliver.sang@...el.com, pasha.tatashin@...een.com, paulmck@...nel.org,
peterx@...hat.com, shakeel.butt@...ux.dev, souravpanda@...gle.com,
vbabka@...e.cz, willy@...radead.org
Subject: Re: [PATCH v5 6/6] docs/mm: document latest changes to vm_lock
On Fri, 6 Dec 2024 19:23:59 -0800, Randy Dunlap wrote:
> Hi,
>
> Can someone explain what the (consistent) usage of '!' does in this file?
> This is the only file in Documentation/ that uses this syntax.
>
>
> E.g.:
>
>> diff --git a/Documentation/mm/process_addrs.rst b/Documentation/mm/process_addrs.rst
>> index 81417fa2ed20..92cf497a9e3c 100644
>> --- a/Documentation/mm/process_addrs.rst
>> +++ b/Documentation/mm/process_addrs.rst
>> @@ -716,7 +716,11 @@ calls :c:func:`!rcu_read_lock` to ensure that the VMA is looked up in an RCU
>> critical section, then attempts to VMA lock it via :c:func:`!vma_start_read`,
>> before releasing the RCU lock via :c:func:`!rcu_read_unlock`.
>>
>> -VMA read locks hold the read lock on the :c:member:`!vma->vm_lock` semaphore for
>> +In cases when the user already holds mmap read lock, :c:func:`!vma_start_read_locked`
>> +and :c:func:`!vma_start_read_locked_nested` can be used. These functions always
>> +succeed in acquiring VMA read lock.
>
Quoting from https://www.sphinx-doc.org/en/master/usage/referencing.html#syntax
* Suppressed link: Prefixing with an exclamation mark (!) prevents the
creation of a link but otherwise keeps the visual output of the role.
For example, writing :py:func:`!target` displays target(), with no link
generated.
This is helpful for cases in which the link target does not exist; e.g.
changelog entries that describe removed functionality, or third-party
libraries that don’t support intersphinx. Suppressing the link prevents
warnings in nitpicky mode.
But in kernel documentation, there is a preferred alternative.
Referencing by function names is the way to go. For example:
calls rcu_read_lock() to ensure that the VMA is looked up in an RCU
critical section, then attempts to VMA lock it via vma_start_read(),
before releasing the RCU lock via rcu_read_unlock().
In cases when the user already holds mmap read lock, vma_start_read_locked()
and vma_start_read_locked_nested() can be used. These functions always
succeed in acquiring VMA read lock.
They work regardless of link target's existence.
Kernel-specific Sphinx extension named "automarkup" does conversions
for you.
HTH, Akira
> thanks.
> --
> ~Randy
Powered by blists - more mailing lists