From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>,
Mauro Carvalho Chehab <mchehab@infradead.org>,
linux-kernel@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Boris Brezillon <boris.brezillon@free-electrons.com>,
Marek Vasut <marek.vasut@gmail.com>,
Richard Weinberger <richard@nod.at>,
Cyrille Pitchen <cyrille.pitchen@atmel.com>,
linux-mtd@lists.infradead.org,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Darren Hart <dvhart@infradead.org>
Subject: [PATCH 22/31] futex-requeue-pi.txt: standardize document format
Date: Thu, 18 May 2017 22:22:27 -0300 [thread overview]
Message-ID: <d84d18fa0cd82f4d2e5a1fe9751ea97c22de8a23.1495156488.git.mchehab@s-opensource.com> (raw)
In-Reply-To: <cover.1495156488.git.mchehab@s-opensource.com>
In-Reply-To: <cover.1495156488.git.mchehab@s-opensource.com>
Each text file under Documentation follows a different
format. Some doesn't even have titles!
Change its representation to follow the adopted standard,
using ReST markups for it to be parseable by Sphinx:
- promote level for the document title;
- mark literal blocks.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
Documentation/futex-requeue-pi.txt | 83 +++++++++++++++++++-------------------
1 file changed, 42 insertions(+), 41 deletions(-)
diff --git a/Documentation/futex-requeue-pi.txt b/Documentation/futex-requeue-pi.txt
index 77b36f59d16b..14ab5787b9a7 100644
--- a/Documentation/futex-requeue-pi.txt
+++ b/Documentation/futex-requeue-pi.txt
@@ -1,5 +1,6 @@
+================
Futex Requeue PI
-----------------
+================
Requeueing of tasks from a non-PI futex to a PI futex requires
special handling in order to ensure the underlying rt_mutex is never
@@ -20,28 +21,28 @@ implementation would wake the highest-priority waiter, and leave the
rest to the natural wakeup inherent in unlocking the mutex
associated with the condvar.
-Consider the simplified glibc calls:
+Consider the simplified glibc calls::
-/* caller must lock mutex */
-pthread_cond_wait(cond, mutex)
-{
- lock(cond->__data.__lock);
- unlock(mutex);
- do {
- unlock(cond->__data.__lock);
- futex_wait(cond->__data.__futex);
- lock(cond->__data.__lock);
- } while(...)
- unlock(cond->__data.__lock);
- lock(mutex);
-}
+ /* caller must lock mutex */
+ pthread_cond_wait(cond, mutex)
+ {
+ lock(cond->__data.__lock);
+ unlock(mutex);
+ do {
+ unlock(cond->__data.__lock);
+ futex_wait(cond->__data.__futex);
+ lock(cond->__data.__lock);
+ } while(...)
+ unlock(cond->__data.__lock);
+ lock(mutex);
+ }
-pthread_cond_broadcast(cond)
-{
- lock(cond->__data.__lock);
- unlock(cond->__data.__lock);
- futex_requeue(cond->data.__futex, cond->mutex);
-}
+ pthread_cond_broadcast(cond)
+ {
+ lock(cond->__data.__lock);
+ unlock(cond->__data.__lock);
+ futex_requeue(cond->data.__futex, cond->mutex);
+ }
Once pthread_cond_broadcast() requeues the tasks, the cond->mutex
has waiters. Note that pthread_cond_wait() attempts to lock the
@@ -53,29 +54,29 @@ In order to support PI-aware pthread_condvar's, the kernel needs to
be able to requeue tasks to PI futexes. This support implies that
upon a successful futex_wait system call, the caller would return to
user space already holding the PI futex. The glibc implementation
-would be modified as follows:
+would be modified as follows::
-/* caller must lock mutex */
-pthread_cond_wait_pi(cond, mutex)
-{
- lock(cond->__data.__lock);
- unlock(mutex);
- do {
- unlock(cond->__data.__lock);
- futex_wait_requeue_pi(cond->__data.__futex);
- lock(cond->__data.__lock);
- } while(...)
- unlock(cond->__data.__lock);
- /* the kernel acquired the mutex for us */
-}
+ /* caller must lock mutex */
+ pthread_cond_wait_pi(cond, mutex)
+ {
+ lock(cond->__data.__lock);
+ unlock(mutex);
+ do {
+ unlock(cond->__data.__lock);
+ futex_wait_requeue_pi(cond->__data.__futex);
+ lock(cond->__data.__lock);
+ } while(...)
+ unlock(cond->__data.__lock);
+ /* the kernel acquired the mutex for us */
+ }
-pthread_cond_broadcast_pi(cond)
-{
- lock(cond->__data.__lock);
- unlock(cond->__data.__lock);
- futex_requeue_pi(cond->data.__futex, cond->mutex);
-}
+ pthread_cond_broadcast_pi(cond)
+ {
+ lock(cond->__data.__lock);
+ unlock(cond->__data.__lock);
+ futex_requeue_pi(cond->data.__futex, cond->mutex);
+ }
The actual glibc implementation will likely test for PI and make the
necessary changes inside the existing calls rather than creating new
--
2.9.4
next prev parent reply other threads:[~2017-05-19 1:43 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 1:22 [PATCH 00/31] Standardize doc formats - part 1 Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 01/31] bcache.txt: standardize document format Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 02/31] bt8xxgpio.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 03/31] btmrvl.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 04/31] bus-virt-phys-mapping.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 05/31] cachetlb.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 06/31] cgroup-v2.txt: " Mauro Carvalho Chehab
2017-05-19 14:59 ` Tejun Heo
2017-06-17 15:18 ` Mauro Carvalho Chehab
2017-06-18 10:46 ` Tejun Heo
2017-05-19 1:22 ` [PATCH 07/31] circular-buffers.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 08/31] clk.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 09/31] cpu-load: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 10/31] cputopology.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 11/31] crc32.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 12/31] dcdbas.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 13/31] digsig.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 14/31] DMA-API.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 15/31] DMA-API-HOWTO.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 16/31] DMA-attributes.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 17/31] DMA-ISA-LPC.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 18/31] debugging-via-ohci1394.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 19/31] efi-stub.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 20/31] eisa.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 21/31] flexible-arrays.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` Mauro Carvalho Chehab [this message]
2017-05-19 1:22 ` [PATCH 23/31] gcc-plugins.txt: " Mauro Carvalho Chehab
2017-05-24 17:35 ` Kees Cook
2017-05-24 20:18 ` Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 24/31] highuid.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 25/31] hw_random.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 26/31] hwspinlock.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 27/31] intel_txt.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 28/31] Intel-IOMMU.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 29/31] io-mapping.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 30/31] io_ordering.txt: " Mauro Carvalho Chehab
2017-05-19 1:22 ` [PATCH 31/31] iostats.txt: " Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d84d18fa0cd82f4d2e5a1fe9751ea97c22de8a23.1495156488.git.mchehab@s-opensource.com \
--to=mchehab@s-opensource.com \
--cc=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=corbet@lwn.net \
--cc=cyrille.pitchen@atmel.com \
--cc=dvhart@infradead.org \
--cc=dwmw2@infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=mchehab@infradead.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=richard@nod.at \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®