All of lore.kernel.org
 help / color / mirror / Atom feed
* Memory barrier -- fix sample code
@ 2016-08-02  0:32 Balbir Singh
  2016-08-02  4:02 ` Paul E. McKenney
  0 siblings, 1 reply; 5+ messages in thread
From: Balbir Singh @ 2016-08-02  0:32 UTC (permalink / raw)
  To: perfbook; +Cc: paulmck

From: Balbir singh <bsingharora@gmail.com>
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.

Signed-off-by: Balbir singh <bsingharora@gmail.com>
---
 advsync/memorybarriers.tex | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/advsync/memorybarriers.tex b/advsync/memorybarriers.tex
index 9eaa0ea..efbd4a2 100644
--- a/advsync/memorybarriers.tex
+++ b/advsync/memorybarriers.tex
@@ -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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-08  4:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-02  0:32 Memory barrier -- fix sample code Balbir Singh
2016-08-02  4:02 ` Paul E. McKenney
2016-08-02  8:05   ` Balbir Singh
2016-08-02 12:09     ` Akira Yokosawa
2016-08-08  4:58       ` Balbir Singh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.