All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] ftrace: fix memory allocation size computation
@ 2011-04-22  7:15 Caspar Zhang
  2011-04-26 16:59 ` Cyril Hrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Caspar Zhang @ 2011-04-22  7:15 UTC (permalink / raw)
  To: LTP List; +Cc: Jiri Olsa

[-- Attachment #1: Type: text/plain, Size: 651 bytes --]


The issue with ftrace_buffer_size.sh is that it allocates 10% of
server's memory. However the tracing ring buffer is implemented using
separate buffers for each CPU in the system. And putting new value to
the buffer_size_kb file increases each CPU buffer with new value. Now
having system with more than 10 CPUs we will get out of memory sooner or
later.

The patch makes sure the memory size is divided by number of CPUs in the
system.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Caspar Zhang <czhang@redhat.com>
---
 .../ftrace_stress/ftrace_buffer_size.sh            |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ftrace-fix-memory-allocation-size-computation.patch --]
[-- Type: text/x-patch; name="0001-ftrace-fix-memory-allocation-size-computation.patch", Size: 740 bytes --]

diff --git a/testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_buffer_size.sh b/testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_buffer_size.sh
index af5a98e..b8f129d 100755
--- a/testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_buffer_size.sh
+++ b/testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_buffer_size.sh
@@ -17,7 +17,9 @@ LOOP=200
 
 # Use up to 10% of free memory
 free_mem=`cat /proc/meminfo | grep '^MemFree' | awk '{ print $2 }'`
-step=$(( $free_mem / 10 / $LOOP ))
+cpus=`cat /proc/cpuinfo | egrep "^processor.*:" | wc -l`
+step=$(( $free_mem / 10 / $LOOP / $cpus ))
+
 if [ $step -eq 0 ]; then
 	$step=1
 	LOOP=50
@@ -40,4 +42,3 @@ for ((; ;))
 
 	sleep 1
 }
-

[-- Attachment #3: Type: text/plain, Size: 384 bytes --]

------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been 
demonstrated beyond question. Learn why your peers are replacing JEE 
containers with lightweight application servers - and what you can gain 
from the move. http://p.sf.net/sfu/vmware-sfemails

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

* Re: [LTP] [PATCH] ftrace: fix memory allocation size computation
  2011-04-22  7:15 [LTP] [PATCH] ftrace: fix memory allocation size computation Caspar Zhang
@ 2011-04-26 16:59 ` Cyril Hrubis
  0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2011-04-26 16:59 UTC (permalink / raw)
  To: Caspar Zhang; +Cc: LTP List, Jiri Olsa

Hi!
Commited, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2011-04-26 16:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-22  7:15 [LTP] [PATCH] ftrace: fix memory allocation size computation Caspar Zhang
2011-04-26 16:59 ` Cyril Hrubis

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.