Skip to contentSkip to conversation

Memory barrier -- fix sample code

PATCH Balbir Singh 3 participants 5 messages Aug 2, 2016 – Aug 8, 2016

lore
Share & tools
lore
#0 lore raw

From: Balbir singh <[email protected]>
Date: Tue, 2 Aug 2016 10:26:34 +1000
Subject: [PATCH] Correct a sample in memorybarriers.tex

We probably don't want to show GFP_KERNEL allocation under spin_lock, GFP_ATOMIC seems much better.

---
 advsync/memorybarriers.tex | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
advsync/memorybarriers.tex +0 -0
index 9eaa0ea..efbd4a2 100644
@@ -936,7 +936,7 @@ Then the following code might leak memory!

 \begin{verbatim}
 spin_lock(&mylock);
 if (p == NULL)
-  p = kmalloc(sizeof(*p), GFP_KERNEL);
+  p = kmalloc(sizeof(*p), GFP_ATOMIC);
 spin_unlock(&mylock);
 \end{verbatim}
 \end{minipage}
--
2.7.4

#1 lore raw
Quoted 8 lines · Balbir Singh

From: Balbir singh <[email protected]>
Date: Tue, 2 Aug 2016 10:26:34 +1000
Subject: [PATCH] Correct a sample in memorybarriers.tex

We probably don't want to show GFP_KERNEL allocation under spin_lock, GFP_ATOMIC seems much better.

Good catch, applied, thank you!

However, I had to apply this by hand due to some recent mass changes to figures containing code. Could you please move to current perfbook.git for future submissions?

Thanx, Paul

Quoted 20 lines

---
 advsync/memorybarriers.tex | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
advsync/memorybarriers.tex +1 -1
index 9eaa0ea..efbd4a2 100644
@@ -936,7 +936,7 @@ Then the following code might leak memory!
  \begin{verbatim}
  spin_lock(&mylock);
  if (p == NULL)
-  p = kmalloc(sizeof(*p), GFP_KERNEL);
+  p = kmalloc(sizeof(*p), GFP_ATOMIC);
  spin_unlock(&mylock);
  \end{verbatim}
  \end{minipage}

--
2.7.4

#2 lore raw
Quoted 10 lines · Paul E. McKenney
Quoted 9 lines · Balbir Singh


From: Balbir singh <[email protected]>
Date: Tue, 2 Aug 2016 10:26:34 +1000
Subject: [PATCH] Correct a sample in memorybarriers.tex
We probably don't want to show GFP_KERNEL allocation under spin_lock, GFP_ATOMIC seems much better.

Quoted 7 lines

Good catch, applied, thank you!

However, I had to apply this by hand due to some recent mass changes to figures containing code.  Could you please move to current perfbook.git for future submissions?

  Thanx, Paul

I thought I did a git pull before patching.

My git-head pointed to 413b7bc1cf6d65368300e96016ac15ac728b66fd

I'll double check. Thanks for applying it by hand

Balbir Singh.

#3 lore raw
Quoted 17 lines · Balbir Singh
Quoted 16 lines · Paul E. McKenney
Quoted 9 lines · Balbir Singh

From: Balbir singh <[email protected]>
Date: Tue, 2 Aug 2016 10:26:34 +1000
Subject: [PATCH] Correct a sample in memorybarriers.tex

We probably don't want to show GFP_KERNEL allocation under spin_lock, GFP_ATOMIC seems much better.

Good catch, applied, thank you!

However, I had to apply this by hand due to some recent mass changes to figures containing code. Could you please move to current perfbook.git for future submissions?

Quoted 8 lines
Quoted 1 line

Thanx, Paul

I thought I did a git pull before patching.

My git-head pointed to 413b7bc1cf6d65368300e96016ac15ac728b66fd

I'll double check. Thanks for applying it by hand

Hi,

Seems like a problem of character encoding.

I see you are using Evolution.
Here is an excerpt from Linux's Documentation/email-clients.txt.

----
Evolution (GUI)

Some people use this successfully for patches.

When composing mail select: Preformat
from Format->Paragraph Style->Preformatted (Ctrl-7) or the toolbar

Then use:
Insert->Text File... (Alt-n x)
to insert the patch.

You can also "diff -Nru old.c new.c | xclip", select Preformat, then paste with the middle button.

----

I hope this helps.

Thanks, Akira

Quoted 6 lines

Balbir Singh.
--
To unsubscribe from this list: send the line "unsubscribe perfbook" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 27 lines · Akira Yokosawa
Quoted 17 lines · Balbir Singh
Quoted 16 lines · Paul E. McKenney
Quoted 9 lines · Balbir Singh

From: Balbir singh <[email protected]>
Date: Tue, 2 Aug 2016 10:26:34 +1000
Subject: [PATCH] Correct a sample in memorybarriers.tex

We probably don't want to show GFP_KERNEL allocation under spin_lock, GFP_ATOMIC seems much better.

Good catch, applied, thank you!

However, I had to apply this by hand due to some recent mass changes to figures containing code. Could you please move to current perfbook.git for future submissions?

Quoted 8 lines
Quoted 1 line

Thanx, Paul

I thought I did a git pull before patching.

My git-head pointed to 413b7bc1cf6d65368300e96016ac15ac728b66fd

I'll double check. Thanks for applying it by hand

Quoted 7 lines

Hi,

Seems like a problem of character encoding.

I see you are using Evolution.
Here is an excerpt from Linux's Documentation/email-clients.txt.

Yes, I do have flow-off and I use an external editor to prevent white space damage. Thanks, I'll double check my editor settings

Balbir