mkinitrd unification across distributions
 help / color / mirror / Atom feed
* [patch 0/2] memory usage trace follow-ups
@ 2013-02-25  6:38 dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2013-02-25  6:38 ` [patch 1/2] move memory usage tracing output to stderr dyoung-H+wXaHxf7aLQT0dZR+AlfA
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA @ 2013-02-25  6:38 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA

Here is two patches to improve the memory usage trace feature:
1/2: redirect memory tracing info to stderr
2/2: add memory trace points in old init scripts

Please help to review

--
Thanks
Dave

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

* [patch 1/2] move memory usage tracing output to stderr
  2013-02-25  6:38 [patch 0/2] memory usage trace follow-ups dyoung-H+wXaHxf7aLQT0dZR+AlfA
@ 2013-02-25  6:38 ` dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2013-02-25  6:38 ` [patch 2/2] add memory usage trace points in the old init script as well dyoung-H+wXaHxf7aLQT0dZR+AlfA
       [not found] ` <20130225063814.423057451-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2 siblings, 0 replies; 4+ messages in thread
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA @ 2013-02-25  6:38 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA
  Cc: Dave Young

[-- Attachment #1: mem-trace-stderr.patch --]
[-- Type: text/plain, Size: 662 bytes --]

memory usage tracing outputs are debug info, so it should be moved to
stderr instead of stdout.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 modules.d/99base/dracut-lib.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- dracut.orig/modules.d/99base/dracut-lib.sh
+++ dracut/modules.d/99base/dracut-lib.sh
@@ -1029,7 +1029,7 @@ make_trace_mem()
     msg="$1"
     shift
     if [ -n "$DEBUG_MEM_LEVEL" ] && [ "$DEBUG_MEM_LEVEL" -gt 0 ]; then
-        make_trace show_memstats $DEBUG_MEM_LEVEL "[debug_mem]" "$msg" "$@"
+        make_trace show_memstats $DEBUG_MEM_LEVEL "[debug_mem]" "$msg" "$@" >&2
     fi
 }
 

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

* [patch 2/2] add memory usage trace points in the old init script as well.
  2013-02-25  6:38 [patch 0/2] memory usage trace follow-ups dyoung-H+wXaHxf7aLQT0dZR+AlfA
  2013-02-25  6:38 ` [patch 1/2] move memory usage tracing output to stderr dyoung-H+wXaHxf7aLQT0dZR+AlfA
@ 2013-02-25  6:38 ` dyoung-H+wXaHxf7aLQT0dZR+AlfA
       [not found] ` <20130225063814.423057451-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2 siblings, 0 replies; 4+ messages in thread
From: dyoung-H+wXaHxf7aLQT0dZR+AlfA @ 2013-02-25  6:38 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA
  Cc: Dave Young

[-- Attachment #1: add-mem-trace-to-hooks-point-in-init-sh.patch --]
[-- Type: text/plain, Size: 3378 bytes --]

Previously I added several trace point to the begin of several
init hooks of systemd, old init script also need this debug info.

Doing same here as what's added in the systemd service scripts:
At cmdline hooks adding trace of "1+:mem 1+:iomem 3+:slab"
For other hooks adding trace of "1:shortmem 2+:mem 3+:slab"

Because we need /proc being mounted before using it in dracut-lib.sh, here
move the . dracut-lib.sh after proc and sysfs mounting code.

Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 modules.d/99base/init.sh |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- dracut.orig/modules.d/99base/init.sh
+++ dracut/modules.d/99base/init.sh
@@ -18,7 +18,6 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
 export PATH
 
 RD_DEBUG=""
-. /lib/dracut-lib.sh
 
 # mount some important things
 [ ! -d /proc/self ] && \
@@ -37,6 +36,8 @@ if [ "$?" != "0" ]; then
     exit 1
 fi
 
+. /lib/dracut-lib.sh
+
 if [ -x /lib/systemd/systemd-timestamp ]; then
     RD_TIMESTAMP=$(/lib/systemd/systemd-timestamp)
 else
@@ -108,6 +109,7 @@ fi
 source_conf /etc/conf.d
 
 # run scriptlets to parse the command line
+make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab'
 getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
 source_hook cmdline
 
@@ -117,6 +119,7 @@ source_hook cmdline
 export root rflags fstype netroot NEWROOT
 
 # pre-udev scripts run before udev starts, and are run only once.
+make_trace_mem "hook pre-udev" '1:shortmem' '2+:mem' '3+:slab'
 getarg 'rd.break=pre-udev' -d 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break before pre-udev"
 source_hook pre-udev
 
@@ -135,6 +138,7 @@ getargbool 0 rd.udev.info -d -y rdudevin
 getargbool 0 rd.udev.debug -d -y rdudevdebug && udevadm control "$UDEV_LOG_PRIO_ARG=debug"
 udevproperty "hookdir=$hookdir"
 
+make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab'
 getarg 'rd.break=pre-trigger' -d 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger"
 source_hook pre-trigger
 
@@ -143,6 +147,7 @@ udevadm control --reload >/dev/null 2>&1
 udevadm trigger --type=subsystems --action=add >/dev/null 2>&1
 udevadm trigger --type=devices --action=add >/dev/null 2>&1
 
+make_trace_mem "hook initqueue" '1:shortmem' '2+:mem' '3+:slab'
 getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
 
 RDRETRY=$(getarg rd.retry -d 'rd_retry=')
@@ -202,6 +207,7 @@ unset RDRETRY
 
 # pre-mount happens before we try to mount the root filesystem,
 # and happens once.
+make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab'
 getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
 source_hook pre-mount
 
@@ -237,9 +243,11 @@ done
 
 # pre pivot scripts are sourced just before we doing cleanup and switch over
 # to the new root.
+make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab'
 getarg 'rd.break=pre-pivot' -d 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
 source_hook pre-pivot
 
+make_trace_mem "hook cleanup" '1:shortmem' '2+:mem' '3+:slab'
 # pre pivot cleanup scripts are sourced just before we switch over to the new root.
 getarg 'rd.break=cleanup' -d 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup"
 source_hook cleanup

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

* Re: [patch 0/2] memory usage trace follow-ups
       [not found] ` <20130225063814.423057451-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-03-11  2:36   ` Dave Young
  0 siblings, 0 replies; 4+ messages in thread
From: Dave Young @ 2013-03-11  2:36 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA, harald-H+wXaHxf7aLQT0dZR+AlfA

On 02/25/2013 02:38 PM, dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org wrote:
> Here is two patches to improve the memory usage trace feature:
> 1/2: redirect memory tracing info to stderr
> 2/2: add memory trace points in old init scripts
> 
> Please help to review

Hello Harald

Any comments on these two patches for memory debug patches?
If you think systemd is encouraged to use then I think only 1/2 is
enough for us.

Thanks..

> 
> --
> Thanks
> Dave
> --
> To unsubscribe from this list: send the line "unsubscribe initramfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


-- 
Thanks
Dave


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

end of thread, other threads:[~2013-03-11  2:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-25  6:38 [patch 0/2] memory usage trace follow-ups dyoung-H+wXaHxf7aLQT0dZR+AlfA
2013-02-25  6:38 ` [patch 1/2] move memory usage tracing output to stderr dyoung-H+wXaHxf7aLQT0dZR+AlfA
2013-02-25  6:38 ` [patch 2/2] add memory usage trace points in the old init script as well dyoung-H+wXaHxf7aLQT0dZR+AlfA
     [not found] ` <20130225063814.423057451-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-11  2:36   ` [patch 0/2] memory usage trace follow-ups Dave Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox