Skip to contentSkip to conversation

docs: ftrace: Clarify the RAM impact of buffer_size_kb

RFC Superseded Frank A. Cancio Bello 2 participants 6 messages Nov 25, 2019

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover docs: ftrace: Clarify the RAM impact of buffer_size_kb

Clarifies the RAM footprint of buffer_size_kb without getting into implementation details.

Changes in v2:
- Removes implementation description of the RAM footprint of buffer_size_kb, but still make the corresponded clarification.

- Removes a patch that was just for illustration purposes because Steven already got the issue that I was referring to.

- Adds a patch to fix other typos in the doc.

Frank A. Cancio Bello (2):
docs: ftrace: Clarify the RAM impact of buffer_size_kb
docs: ftrace: Fix typos

 Documentation/trace/ftrace.rst             | 9 +++++----
 Documentation/trace/ring-buffer-design.txt | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

RFC v2 1/2 docs: ftrace: Clarify the RAM impact of buffer_size_kb

The current text could mislead the user into believing that the number of pages allocated by each CPU ring buffer is calculated by the round up of the division: buffer_size_kb / PAGE_SIZE.

Clarifies that a few extra pages may be allocated to accommodate buffer management meta-data.

---
 Documentation/trace/ftrace.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/trace/ftrace.rst +2 -1
index d2b5657ed33e..2b21068ebf8e 100644
@@ -185,7 +185,8 @@ of ftrace. Here is a list of some of the key files:
 	CPU buffer and not total size of all buffers. The
 	trace buffers are allocated in pages (blocks of memory
 	that the kernel uses for allocation, usually 4 KB in size).
-	If the last page allocated has room for more bytes
+	A few extra pages may be allocated to accommodate buffer management
+        meta-data. If the last page allocated has room for more bytes
 	than requested, the rest of the page will be used,
 	making the actual allocation bigger than requested or shown.
 	( Note, the size may not be a multiple of the page size
Signature · 1 line
2.17.1
#2 lore raw

RFC v2 2/2 docs: ftrace: Fix typos

In reply to Frank A. Cancio Bello

Fix minor typos in the doc.

---
 Documentation/trace/ftrace.rst             | 6 +++---
 Documentation/trace/ring-buffer-design.txt | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
Documentation/trace/ftrace.rst +3 -3
index 2b21068ebf8e..9e7b45485ea1 100644
@@ -236,7 +236,7 @@ of ftrace. Here is a list of some of the key files:
 	This interface also allows for commands to be used. See the
 	"Filter commands" section for more details.
 
-	As a speed up, since processing strings can't be quite expensive
+	As a speed up, since processing strings can be quite expensive
 	and requires a check of all functions registered to tracing, instead
 	an index can be written into this file. A number (starting with "1")
 	written will instead select the same corresponding at the line position
@@ -383,7 +383,7 @@ of ftrace. Here is a list of some of the key files:
 
 	By default, 128 comms are saved (see "saved_cmdlines" above). To
 	increase or decrease the amount of comms that are cached, echo
-	in a the number of comms to cache, into this file.
+	in the number of comms to cache, into this file.
 
   saved_tgids:
 
@@ -3325,7 +3325,7 @@ directories after it is created.
 
 As you can see, the new directory looks similar to the tracing directory
 itself. In fact, it is very similar, except that the buffer and
-events are agnostic from the main director, or from any other
+events are agnostic from the main directory, or from any other
 instances that are created.
 
 The files in the new directory work just like the files with the
Documentation/trace/ring-buffer-design.txt +1 -1
index ff747b6fa39b..2d53c6f25b91 100644
@@ -37,7 +37,7 @@ commit_page - a pointer to the page with the last finished non-nested write.
 
 cmpxchg - hardware-assisted atomic transaction that performs the following:
 
-   A = B iff previous A == C
+   A = B if previous A == C
 
    R = cmpxchg(A, C, B) is saying that we replace A with B if and only if
       current A is equal to C, and we put the old (current) A into R
Signature · 1 line
2.17.1
maintainer
#3 lore raw

Re: [RFC v2 2/2] docs: ftrace: Fix typos

Documentation/trace/ring-buffer-design.txt commit_page - a pointer to the page with the last finished non-nested write. · line 40

Quoted 8 lines · On Sun, 24 Nov 2019 23:38:41 -0500 "Frank A. Cancio Bello"…
Documentation/trace/ring-buffer-design.txt +1 -1
@@ -37,7 +37,7 @@ commit_page - a pointer to the page with the last finished non-nested write.
 
 cmpxchg - hardware-assisted atomic transaction that performs the following:
 
-   A = B iff previous A == C
+   A = B if previous A == C

This wasn't a typo. "iff" means "if and only if" which is a standard notation. That is, this is shorthand for:

A = B if previous A == C
previous A == C if A = B

-- Steve

Quoted 4 lines
Documentation/trace/ring-buffer-design.txt +0 -0
    R = cmpxchg(A, C, B) is saying that we replace A with B if and only if
       current A is equal to C, and we put the old (current) A into R
maintainer
#4 lore raw

Re: [RFC v2 2/2] docs: ftrace: Fix typos

Quoted 9 lines · On Mon, 25 Nov 2019 12:37:09 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 6 lines · On Sun, 24 Nov 2019 23:38:41 -0500 "Frank A. Cancio Bello"…
Documentation/trace/ring-buffer-design.txt +0 -0
@@ -37,7 +37,7 @@ commit_page - a pointer to the page with the last finished non-nested write.
 
 cmpxchg - hardware-assisted atomic transaction that performs the following:
 
Quoted 8 lines

Documentation/trace/ring-buffer-design.txt commit_page - a pointer to the page with the last finished non-nested write. · line 40

Quoted 2 lines
Documentation/trace/ring-buffer-design.txt +1 -1
-   A = B iff previous A == C
+   A = B if previous A == C  

This wasn't a typo. "iff" means "if and only if" which is a standard notation. That is, this is shorthand for:

A = B if previous A == C
previous A == C if A = B

Although thinking about this more, this may not be correct. If previous A == B, then A = B, thus the "iff" notation is not actually accurate.

This wouldn't then be a typo fix, but a real fix to the logic ;-)

-- Steve

Quoted 6 lines
Quoted 6 lines
Documentation/trace/ring-buffer-design.txt +0 -0
    R = cmpxchg(A, C, B) is saying that we replace A with B if and only if
       current A is equal to C, and we put the old (current) A into R
#5 lore raw

Re: [RFC v2 2/2] docs: ftrace: Fix typos

Quoted 18 lines · Steven Rostedt
Quoted 15 lines · On Mon, 25 Nov 2019 12:37:09 -0500 Steven Rostedt <[email protected]> wrote:

Documentation/trace/ring-buffer-design.txt commit_page - a pointer to the page with the last finished non-nested write. · line 40

Quoted 8 lines · On Sun, 24 Nov 2019 23:38:41 -0500 "Frank A. Cancio Bello"…
Documentation/trace/ring-buffer-design.txt +1 -1
@@ -37,7 +37,7 @@ commit_page - a pointer to the page with the last finished non-nested write.
 
 cmpxchg - hardware-assisted atomic transaction that performs the following:
 
-   A = B iff previous A == C
+   A = B if previous A == C  

This wasn't a typo. "iff" means "if and only if" which is a standard notation. That is, this is shorthand for:

Quoted 9 lines
Quoted 2 lines

A = B if previous A == C
previous A == C if A = B

Although thinking about this more, this may not be correct. If previous A == B, then A = B, thus the "iff" notation is not actually accurate.

This wouldn't then be a typo fix, but a real fix to the logic ;-)

What are the odds ;)

I knew about the concept https://en.wikipedia.org/wiki/If_and_only_if
from school math but didn't remember the notation. For me was suspicious so, I looked in "the cmpxchg doc" and nothing referring to "iff" was there, then I decided to classified it as a typo.

Now thinking more deeply, I agreed with you that was not a typo but a "logic mistake", even not for the same reason ;)

Being not 100% sure of what I'm about to say, I will say it anyway because you have been kind enough to write the second email.

"if and only if (shortened as iff) is a biconditional logical connective between statements" and A = B can't be considered a logical statement in the context of that definition (math/logic), even it could be in C.

Thank you Steven one more time for such a quick reply! frank a.