From 4c2732a1dad1de295c9219ee3afac007b2d7ba05 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 28 Jan 2009 14:36:08 -0800 Subject: Use 'static' as much as possible This change just inserts 'static' on runtime, tapset, and generated C functions and globals, so the compiler can do a better job of optimizing. My tests with small scripts show ~10% reduction in compile time and ~20% reduction in module size. Larger scripts may show less benefit, but I expect purely positive results. --- runtime/procfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'runtime/procfs.c') diff --git a/runtime/procfs.c b/runtime/procfs.c index 0fe22aba..98d0af98 100644 --- a/runtime/procfs.c +++ b/runtime/procfs.c @@ -22,7 +22,7 @@ static struct proc_dir_entry *_stp_procfs_files[STP_MAX_PROCFS_FILES]; static struct proc_dir_entry *_stp_proc_stap = NULL; static struct proc_dir_entry *_stp_proc_root = NULL; -void _stp_close_procfs(void); +static void _stp_close_procfs(void); // 2.6.24 fixed proc_dir_entry refcounting. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) @@ -34,7 +34,7 @@ void _stp_close_procfs(void); /* * Removes /proc/systemtap/{module_name} and /proc/systemtap (if empty) */ -void _stp_rmdir_proc_module(void) +static void _stp_rmdir_proc_module(void) { if (_stp_proc_root && _stp_proc_root->subdir == NULL) { if (atomic_read(&_stp_proc_root->count) != LAST_ENTRY_COUNT) @@ -71,7 +71,7 @@ void _stp_rmdir_proc_module(void) * Safely creates /proc/systemtap (if necessary) and * /proc/systemtap/{module_name}. */ -int _stp_mkdir_proc_module(void) +static int _stp_mkdir_proc_module(void) { if (_stp_proc_root == NULL) { struct nameidata nd; @@ -128,7 +128,7 @@ static struct proc_dir_entry *_stp_procfs_lookup(const char *dir, struct proc_di return NULL; } -int _stp_create_procfs(const char *path, int num) +static int _stp_create_procfs(const char *path, int num) { const char *p; char *next; @@ -195,7 +195,7 @@ err: return -1; } -void _stp_close_procfs(void) +static void _stp_close_procfs(void) { int i; for (i = _stp_num_pde-1; i >= 0; i--) { -- cgit From 2c48e4162100e7cbc53eeaee13cfbdd538b15380 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 6 Feb 2009 12:19:22 -0500 Subject: 2.6.29rc build fix: autoconf for proc_dir_entry->owner going away --- runtime/procfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'runtime/procfs.c') diff --git a/runtime/procfs.c b/runtime/procfs.c index 98d0af98..4011ebfc 100644 --- a/runtime/procfs.c +++ b/runtime/procfs.c @@ -1,7 +1,7 @@ /* -*- linux-c -*- * * /proc command channels - * Copyright (C) 2007 Red Hat Inc. + * Copyright (C) 2007-2009 Red Hat Inc. * * This file is part of systemtap, and is free software. You can * redistribute it and/or modify it under the terms of the GNU General @@ -105,8 +105,10 @@ static int _stp_mkdir_proc_module(void) } _stp_proc_root = proc_mkdir(THIS_MODULE->name, _stp_proc_stap); +#ifdef AUTOCONF_PROCFS_OWNER if (_stp_proc_root != NULL) _stp_proc_root->owner = THIS_MODULE; +#endif _stp_unlock_debugfs(); } @@ -161,7 +163,9 @@ static int _stp_create_procfs(const char *path, int num) goto err; } _stp_pde[_stp_num_pde++] = last_dir; +#ifdef AUTOCONF_PROCFS_OWNER last_dir->owner = THIS_MODULE; +#endif last_dir->uid = _stp_uid; last_dir->gid = _stp_gid; } else { -- cgit From 8df79eb6046f2fa2e1aed736b2adac4eaaf3a2f5 Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 12 Feb 2009 14:52:40 -0600 Subject: Cleanup. Renamed _stp_{un}lock_debugfs() to _stp_{un}lock_transport_dir(). 2009-02-12 David Smith * transport.c (_stp_lock_transport_dir): Renamed from _stp_lock_debugfs(), since on older kernels this actually uses procfs. (_stp_unlock_transport_dir): Renamed from _stp_unlock_debugfs(), since on older kernels this actually uses procfs. (_stp_lock_transport_dir): Changed _stp_lock_debugfs()/_stp_unlock_debugfs() to _stp_lock_transport_dir()/_stp_unlock_transport_dir(). * transport.h: Ditto. Also added _stp_transport_init() prototype. * utt.c (utt_remove_root): Changed _stp_lock_debugfs()/_stp_unlock_debugfs() to _stp_lock_transport_dir()/_stp_unlock_transport_dir(). * relayfs.c (_stp_remove_relay_root): Ditto. 2009-02-12 David Smith * procfs.c (_stp_rmdir_proc_module): Changed _stp_lock_debugfs()/_stp_unlock_debugfs() to _stp_lock_transport_dir()/_stp_unlock_transport_dir(). (_stp_mkdir_proc_module): Ditto. --- runtime/procfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'runtime/procfs.c') diff --git a/runtime/procfs.c b/runtime/procfs.c index 4011ebfc..afedb4f4 100644 --- a/runtime/procfs.c +++ b/runtime/procfs.c @@ -45,7 +45,7 @@ static void _stp_rmdir_proc_module(void) } if (_stp_proc_stap) { - if (!_stp_lock_debugfs()) { + if (!_stp_lock_transport_dir()) { errk("Unable to lock transport directory.\n"); return; } @@ -62,7 +62,7 @@ static void _stp_rmdir_proc_module(void) _stp_proc_stap = NULL; } - _stp_unlock_debugfs(); + _stp_unlock_transport_dir(); } } @@ -76,7 +76,7 @@ static int _stp_mkdir_proc_module(void) if (_stp_proc_root == NULL) { struct nameidata nd; - if (!_stp_lock_debugfs()) { + if (!_stp_lock_transport_dir()) { errk("Unable to lock transport directory.\n"); goto done; } @@ -90,7 +90,7 @@ static int _stp_mkdir_proc_module(void) /* doesn't exist, so create it */ _stp_proc_stap = proc_mkdir ("systemtap", NULL); if (_stp_proc_stap == NULL) { - _stp_unlock_debugfs(); + _stp_unlock_transport_dir(); goto done; } } else { @@ -110,7 +110,7 @@ static int _stp_mkdir_proc_module(void) _stp_proc_root->owner = THIS_MODULE; #endif - _stp_unlock_debugfs(); + _stp_unlock_transport_dir(); } done: return (_stp_proc_root) ? 1 : 0; -- cgit From 177bcaebf508bb86f06a4f7b0830096cf2f3acc5 Mon Sep 17 00:00:00 2001 From: David Smith Date: Fri, 13 Feb 2009 12:08:56 -0600 Subject: Fixed transport/procfs.c for systems that use the old transport (RHEL4). 2009-02-13 David Smith * procfs.c: Added macros to guard against multiple inclusion. 2009-02-13 David Smith * procfs.c: Added inclusion of ../procfs.c for _stp_mkdir_proc_module(). --- runtime/procfs.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'runtime/procfs.c') diff --git a/runtime/procfs.c b/runtime/procfs.c index afedb4f4..7e3c8352 100644 --- a/runtime/procfs.c +++ b/runtime/procfs.c @@ -14,6 +14,9 @@ * number of needed files. */ +#ifndef _STP_PROCFS_C_ +#define _STP_PROCFS_C_ + #define STP_MAX_PROCFS_FILES 16 static int _stp_num_pde = 0; static int _stp_num_procfs_files = 0; @@ -209,3 +212,5 @@ static void _stp_close_procfs(void) _stp_num_pde = 0; _stp_rmdir_proc_module(); } + +#endif /* _STP_PROCFS_C_ */ -- cgit From 321b13b9ac2a395db1c7591cfe86bddfc0944e25 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 18 Feb 2009 09:29:39 -0600 Subject: Removed unused functions and variables. 2009-02-18 David Smith * io.c (_stp_log): Removed unused function. * map.c (_stp_cmp): Replace _stp_log() with dbug(). * mempool.c (_stp_mempool_resize): Removed unused function. * print.c (next_fmt): Removed unused function. * procfs.c: Removed unused variable '_stp_num_procfs_files'. * regs.c (_stp_ret_addr): Removed unused function. * string.c (_stp_text_str): Removed unused variable 'len'. * string.h: Removed unused variable '_stdout_' and function declaration for deleted function '_stp_vsprintf'. * sym.c: Removed unused variables. * unwind.c (_stp_create_unwind_hdr): Removed unused function. 2009-02-18 David Smith * control.c: Removed unused variable '_stp_current_buffers'. * procfs.c (_stp_set_buffers): Removed unused function. (_stp_register_ctl_channel_fs): Removed unused variables and label. * symbols.c (u32_swap): Removed unused function. (generic_swap): Ditto. (_stp_sort): Ditto. (_stp_section_is_interesting): Ditto. * transport.c (_stp_transport_init): Removed unused variable 'ret'. --- runtime/procfs.c | 1 - 1 file changed, 1 deletion(-) (limited to 'runtime/procfs.c') diff --git a/runtime/procfs.c b/runtime/procfs.c index 7e3c8352..d6b75336 100644 --- a/runtime/procfs.c +++ b/runtime/procfs.c @@ -19,7 +19,6 @@ #define STP_MAX_PROCFS_FILES 16 static int _stp_num_pde = 0; -static int _stp_num_procfs_files = 0; static struct proc_dir_entry *_stp_pde[STP_MAX_PROCFS_FILES]; static struct proc_dir_entry *_stp_procfs_files[STP_MAX_PROCFS_FILES]; static struct proc_dir_entry *_stp_proc_stap = NULL; -- cgit