General
cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple entries for a shared lib private data in pmap output.

SOLVED
Go to solution
Raghava_1
Occasional Advisor

Multiple entries for a shared lib private data in pmap output.

Hi,

We have a service which makes use of a host of shared libraries. When the service is run and the shared libs are loaded, we ran pmap on the pid of the particular service in order to know the usage of memory and allied data.

But, for a particular library, we see that entries corresponding to PD [private data] are shown twice.

[myhost]/me> pmap 13797 | grep -i
dc8c6000 1512K 1332K PD rw- /app/runtime/exe/libb3.so
dcae8000 10.3M 7928K PD rwx /app/runtime/exe/libb3.so
dd50c000 1744K 1376K PD rw- /app/runtime/exe/libb2.so
dd718000 11.7M 8548K PD rwx /app/runtime/exe/libb2.so
de27a000 1304K 1260K PD rw- /app/runtime/exe/libb1.so
de43c000 9696K 6992K PD rwx /app/runtime/exe/libb1.so
[myhost]/me> pmap 13797 |grep -w "runtime/exe"|grep -w PD|awk '{print $6}'|wc -l
179
[myhost]/me> pmap 13797 |grep -w "runtime/exe"|grep -w PD|awk '{print $6}'|sort -u|wc -l
90
[myhost]/me>

All our libraries had two entries corresponding to 'PD' as shown through pmap.
Should not the PD for a particular shared lib be shown just once? And if not, what is the significance of two entries and which one is to be considered a reference for our analysis concerning measuring the footprint of our service?

Please provide info or pointers to further reference.

Thanks.
_raghava_

PS: Same query put up in workload/resource management section [http://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1369019]
9 REPLIES
Laurent Menase
Honored Contributor

Re: Multiple entries for a shared lib private data in pmap output.

I think that your shared lib is rw , so load as private.

try a chmod 555 on it.

Laurent Menase
Honored Contributor

Re: Multiple entries for a shared lib private data in pmap output.

usually one is shared, and is the code
the other is the static data of the shared lib, and is private.
Probably the rwx should be only r-x and is probably the text segment, the rw- is probably the static data
Raghava_1
Occasional Advisor

Re: Multiple entries for a shared lib private data in pmap output.

Surely Laurent. Will ensure duplicate posts won't happen again.

Ran a 'chatr +dbg enable' to set private mapping. Also, did set file access mode to 555.
Still, multiple entries for PD as seen from pmap. :(

[myhost]/me> pmap 6713 | grep libb
dc9c6000 1512K 1368K PD rw- /tmp/PMAP-LOG/libb/libb3.so
dcbe8000 10M 4740K PD rwx /tmp/PMAP-LOG/libb/libb3.so
dd5cc000 1744K 1376K PD rw- /tmp/PMAP-LOG/libb/libb2.so
dd7dc000 11.3M 5224K PD rwx /tmp/PMAP-LOG/libb/libb2.so
de2fa000 1304K 1272K PD rw- /tmp/PMAP-LOG/libb/libb1.so
de494000 9348K 4500K PD rwx /tmp/PMAP-LOG/libb/libb1.so
[myhost]/me> ls -lrt /tmp/PMAP-LOG/libb/libb*
-r-xr-xr-x 1 me adm 15414996 Sep 4 12:29 /tmp/PMAP-LOG/libb/libb1.so
-r-xr-xr-x 1 me adm 18761784 Sep 4 12:29 /tmp/PMAP-LOG/libb/libb2.so
-r-xr-xr-x 1 me adm 16624648 Sep 4 12:29 /tmp/PMAP-LOG/libb/libb3.so
[myhost]/me> chatr /tmp/PMAP-LOG/libb/libb1.so | grep -iw private
shared library mapped private enabled
[myhost]/me> chatr /tmp/PMAP-LOG/libb/libb2.so | grep -iw private
shared library mapped private enabled
[myhost]/me> chatr /tmp/PMAP-LOG/libb/libb3.so | grep -iw private
shared library mapped private enabled
[myhost]/me>
Dennis Handly
Acclaimed Contributor

Re: Multiple entries for a shared lib private data in pmap output.

>we see that entries corresponding to PD [private data] are shown twice.

What does "size libb3.so" show? Does the text match with 10.3M and data 1512K?

>which one is to be considered a reference for our analysis concerning measuring the footprint of our service?

If both are PD, then both need to be counted.

>Please provide info

If you want to continue to get info, you need to look into your point assignment:
assigned points to 0 of 8
http://forums.itrc.hp.com/service/forums/pageList.do?userId=WW218166&listType=unassigned&forumId=1

>Ran a 'chatr +dbg enable' to set private mapping.
>shared library mapped private enabled

You absolutely positively don't want to do that! That maps your text as private.
Raghava_1
Occasional Advisor

Re: Multiple entries for a shared lib private data in pmap output.

Thanks Dennis.

>>points.
Done. I regret the delay.

size libb*so shows as below [have taken out hex column, will it help if put?]

text data bss dec filename
9569404 1332127 310864 11212395 libb1.so
11538454 1782844 305920 13627218 libb2.so
10249065 1546992 607056 12403113 libb3.so

>>If both are PD, then both need to be counted.
Please correct me if am wrong; but should not pmap output have exactly one line each for PD and SC per shared lib under use? I still am not understanding the significance of two sets of the same shared lib being used by the process.

>>mapping text to private.
I do understand the impact. We use private mapping only while debugging the libs (in a controlled local env) and not always. This was just a check.

Thanks again.
Dennis Handly
Acclaimed Contributor

Re: Multiple entries for a shared lib private data in pmap output.

>size libb*so shows as below [have taken out hex column, will it help if put?]

(Your pmap data is in decimal. That's why I didn't mention size -x.)

These compare very closely with your pmap data:
1512K PD rw- libb3.so
10.3M PD rwx libb3.so
10,249,065 1,546,992 607,056 libb3.so
And the BSS has another mmap.

>but should not pmap output have exactly one line each for PD and SC per shared lib under use? I still am not understanding the significance of two sets of the same shared lib being used by the process.

You have two PDs because you used the "evil" "chatr +dbg enable". Did you forget to disable this on your application? Or are you currently debugging?
Raghava_1
Occasional Advisor

Re: Multiple entries for a shared lib private data in pmap output.

Ok.

>>You have two PDs because you used the "evil" "chatr +dbg enable".

No. What is mentioned @thread start here was without having 'chatr +dbg enable' done. Am quite sure about it.

Also, as could be seen below; we have two sets of entries for private data even with private mapping disabled. Hence, the doubt in the first place.

[myhost]/me> pmap 2968 | grep libb
dc9c6000 1512K 1368K PD rw- /tmp/PMAP-LOG/libb/libb3.so
dcc04000 10M 4740K PD rwx /tmp/PMAP-LOG/libb/libb3.so
dd5cc000 1744K 1376K PD rw- /tmp/PMAP-LOG/libb/libb2.so
dd7f8000 11.3M 5224K PD rwx /tmp/PMAP-LOG/libb/libb2.so
de2fa000 1304K 1272K PD rw- /tmp/PMAP-LOG/libb/libb1.so
de4a8000 9348K 4500K PD rwx /tmp/PMAP-LOG/libb/libb1.so
[myhost]/tmp/PMAP-LOG/libb> chatr libb*so | grep -w private
shared library mapped private disabled
shared library mapped private disabled
shared library mapped private disabled
[myhost]/tmp/PMAP-LOG/libb> ls -l libb*so
-r-xr-xr-x 1 me adm 15414996 Sep 4 16:20 libb1.so
-r-xr-xr-x 1 me adm 18761784 Sep 4 16:20 libb2.so
-r-xr-xr-x 1 me adm 16624648 Sep 4 16:20 libb3.so
[myhost]/tmp/PMAP-LOG/libb>

(let me also mention that I have restarted my process after changing permissions/running through chatr etc)
Dennis Handly
Acclaimed Contributor
Solution

Re: Multiple entries for a shared lib private data in pmap output.

>What is mentioned at thread start here was without having 'chatr +dbg enable' done.

Sorry for not realizing this on my first reply, you have fallen into the chatr(1) trap of having an option that doesn't work for shlibs but chatr shows something changed, giving you the illusion it works.

For this option, you must use chatr(1) on the executable, not each shlib!

http://docs.hp.com/en/5187-8590/5187-8590.pdf
chatr +dbg enable
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1238538
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=943480

>as could be seen below; we have two sets of entries for private data

Because you have it enabled on the executable.

>I have restarted my process after changing permissions/running through chatr etc)

There are several conclusions you can make if you didn't restart:
1) If chatr(1) worked, it wasn't mapped shared.
2) If it was mapped shared, chatr(1) would fail.
Raghava_1
Occasional Advisor

Re: Multiple entries for a shared lib private data in pmap output.

Thanks a lot Dennis! This reply clarified our doubt precisely.

Thanks again,
_raghava_

/* Comment by Dennis above (timestamp Sep 4, 2009 20:16:35 GMT) provides the solution to the query. */