Gopi Desaboyina Solaris Blogs

Just another WordPress.com weblog

Which Process is Swapped out ?

Recently I had encountered strange issue. Box has ample of free Mem,swap space but still vmstat shows 4 in w field. That means they are runnable and but they were swapped out ? but why ? let me explain

If your system ever gets low on memory and processes are swapped out, it may take a long time for them to get back into memory. This is especially true if they are daemons which are not run often, because they have to receive an event in order to try to run again. This is not necessarily bad, as long as when they need to run, they will have the memory to do so. In my case it was devfsadmd .I restarted the daemon. everything is fine with vmstat. Though it never it creates problem, but makes you nervous as if you were low on memory but it’s not.

How do we find which process is swapped out ??
well, you can use ps command like below and look for RSS size 0 ( as it was swapped out). you should exclude system process like sched,pgout,fsflush

ps -eo pid,rss,args | sort -n +1

Other Method using below mdb which I found in google.

echo "::walk thread | ::print kthread_t t_schedflag t_procp" | mdb -k | while
read line; do key=${line%% =*}; val=${line##*= }; if [[ "$key" = "t_schedflag"
]] && [[ "$(($val))" -eq "$(($val | 0x1))" ]]; then skip=1; continue; fi; if [[
"$key" = "t_procp" ]]; then if [[ $skip -ne 1 ]]; then echo "$val::ps" | mdb -k;
else skip=0; fi; fi; done

If process are swapping out very frequently and you are low on free mem perhaps you might have to examine your system and add more mem.

Advertisements

April 10, 2009 - Posted by | Solaris |

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: