FAQ Search Today's Posts Mark Forums Read

» Linux Archive
Home
New Posts
Search
FAQ


Go Back   Linux Archive > Redhat > Crash Utility

 
 
LinkBack Thread Tools
 
Old 02-04-2008, 02:57 PM
Dave Anderson
 
Default SIAL ps.c: Fix wrong access to .counter on non-SMP kernels

Bernhard Walle wrote:

This patch fixes following SIAL error when loading ps.c SIAL sample script on a
non-SMP system (kernel):

File /usr/share/sial/crash/ps.c, line 130, Error: Expression
for member 'counter' is not a struct/union

The problem behind is that mm_counter_t is defined as 'unsigned long' on
systems which have NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS (in practise for
distribution kernels, that are only UMP kernels -- I don't know how to test for
that condition in SIAL).


Signed-off-by: Bernhard Walle <bwalle@suse.de>

---
ps.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

--- a/ps.c
+++ b/ps.c
@@ -127,7 +127,16 @@ int getasattr(task_t *t, int f)
return t->mm->rss*4;
} else {
struct mm_struct *mm=t->mm?t->mm:t->active_mm;
- return (mm->_file_rss.counter+mm->_anon_rss.counter)*4;
+
+ /*
+ * on a SMP kernel (with a reasonable amount of NR_CPUS),
+ * the _anon_rss and _file_rss is a atomic_t, on a UMP kernel
+ * it's a normal integer
+ */
+ if (exists("smp_num_cpus") || exists("__per_cpu_offset"))
+ return (mm->_file_rss.counter+mm->_anon_rss.counter)*4;
+ else
+ return (mm->_file_rss+mm->_anon_rss)*4;
}
case 2:
return t->mm->total_vm*4;

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility



http://people.redhat.com/anderson/extensions/ps.c has been updated
with the patch above.




--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 

Thread Tools




All times are GMT. The time now is 10:13 PM.

VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org