New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common/MemoryModel: Bump int to long and drop mallinfo #13453

Merged
merged 1 commit into from Mar 8, 2017

Conversation

Projects
None yet
2 participants
@xiaoxichen
Contributor

xiaoxichen commented Feb 16, 2017

mallinfo(3) doesnt have 64bit compatible version so when
malloc size > 4GB, either wrapped value or a negtive value
returned, which is really misleading.

Also bump up all int to long to prevent overflow oneday we
have > 2TB memory.

Signed-off-by: Xiaoxi Chen xiaoxchen@ebay.com

@@ -93,15 +92,5 @@ void MemoryModel::_sample(snap *psnap)
heap += size;
}
psnap->heap = heap >> 10;

This comment has been minimized.

@jcsp

jcsp Feb 16, 2017

Contributor

Why does this line need removing?

This comment has been minimized.

@xiaoxichen

xiaoxichen Feb 17, 2017

Contributor

hmm, accidently remove it....will take it back

@jcsp

This comment has been minimized.

Contributor

jcsp commented Feb 16, 2017

From the fact that it apparently compiles after removing the malloc and mmap fields, I guess they weren't used anywhere, right?

@xiaoxichen

This comment has been minimized.

Contributor

xiaoxichen commented Feb 17, 2017

Nowhere except the performance counter/Logging in MemoryModel

@xiaoxichen

This comment has been minimized.

Contributor

xiaoxichen commented Feb 17, 2017

@jcsp fixed

@xiaoxichen

This comment has been minimized.

Contributor

xiaoxichen commented Feb 17, 2017

@jcsp l take another look, seems the "heap" calculation (L63-L96) is also problematic.

1. the memory allocated by TCmalloc( probably also jemalloc) are NOT taken into account, as the segment marked as "P" instead of "rw-p", in /proc//map.

tcmalloc: large alloc 1073741824 bytes == 0x2928000 @ 0x7f1457405c4c 0x7f1457424040 0x40073f 0x7f145704ff45 0x400669 (nil)

root@xiaoxi-ceph-dev-1095533:~# cat /proc/4472/maps | grep rw
00601000-00602000 rw-p 00001000 fd:01 521554 /home/xiaoxchen/a.out
0210b000-42a0c000 rw-p 00000000 00:00 0 [heap]
7f14561b2000-7f14561b3000 rw-p 00003000 fd:01 8154 /lib/x86_64-linux-gnu/libdl-2.19.so
7f14563c8000-7f14563c9000 rw-p 00015000 fd:01 8173 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f14565ea000-7f14565eb000 rw-p 00021000 fd:01 8083 /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7f14568f0000-7f14568f1000 rw-p 00105000 fd:01 8162 /lib/x86_64-linux-gnu/libm-2.19.so
7f1456bde000-7f1456be0000 rw-p 000ed000 fd:01 30263 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
7f1456be0000-7f1456bf5000 rw-p 00000000 00:00 0
7f1456e0e000-7f1456e0f000 rw-p 00019000 fd:01 8179 /lib/x86_64-linux-gnu/libpthread-2.19.so
7f1456e0f000-7f1456e13000 rw-p 00000000 00:00 0
7f145701f000-7f1457020000 rw-p 0000c000 fd:01 43405 /usr/lib/x86_64-linux-gnu/libunwind.so.8.0.1
7f1457020000-7f145702e000 rw-p 00000000 00:00 0
7f14573ec000-7f14573ee000 rw-p 001be000 fd:01 8063 /lib/x86_64-linux-gnu/libc-2.19.so
7f14573ee000-7f14573f3000 rw-p 00000000 00:00 0
7f1457636000-7f1457637000 rw-p 00043000 fd:01 43620 /usr/lib/libtcmalloc.so.4.1.2
7f1457637000-7f145765e000 rw-p 00000000 00:00 0
7f145786a000-7f1457871000 rw-p 00000000 00:00 0
7f145787a000-7f1457880000 rw-p 00000000 00:00 0
7f1457881000-7f1457882000 rw-p 00023000 fd:01 8166 /lib/x86_64-linux-gnu/ld-2.19.so
7f1457882000-7f1457883000 rw-p 00000000 00:00 0
7ffdfb72d000-7ffdfb74e000 rw-p 00000000 00:00 0 [stack]

2. Stack segments are taken into account and are majority contributor of this number .

root@lvs02-mds-3-1257633:~# cat /proc/16822/maps | grep stack
7f3eecf75000-7f3eed075000 rw-p 00000000 00:00 0 [stack:27365]
7f3eed67c000-7f3eed77c000 rw-p 00000000 00:00 0 [stack:23757]
7f3eed77d000-7f3eed87d000 rw-p 00000000 00:00 0 [stack:31112]
7f3eed87e000-7f3eed97e000 rw-p 00000000 00:00 0 [stack:30786]
7f3eed97f000-7f3eeda7f000 rw-p 00000000 00:00 0 [stack:26733]
7f3eeda80000-7f3eedb80000 rw-p 00000000 00:00 0 [stack:26454]
7f3eedb81000-7f3eedc81000 rw-p 00000000 00:00 0 [stack:25903]
7f3eedc82000-7f3eedd82000 rw-p 00000000 00:00 0 [stack:30083]
7f3eedd83000-7f3eede83000 rw-p 00000000 00:00 0 [stack:30423]
7f3eede84000-7f3eedf84000 rw-p 00000000 00:00 0 [stack:25778]
7f3eedf85000-7f3eee085000 rw-p 00000000 00:00 0 [stack:29821]
7f3eee086000-7f3eee186000 rw-p 00000000 00:00 0 [stack:29416]
7f3eee187000-7f3eee287000 rw-p 00000000 00:00 0 [stack:30799]
7f3eee288000-7f3eee388000 rw-p 00000000 00:00 0 [stack:29424]
7f3eee389000-7f3eee489000 rw-p 00000000 00:00 0 [stack:31439]
7f3eee48a000-7f3eee58a000 rw-p 00000000 00:00 0 [stack:30633]
........
.....

@@ -7386,7 +7385,6 @@ void MDCache::check_memory_usage()
mds->mlogger->set(l_mdm_rss, last.get_rss());
mds->mlogger->set(l_mdm_heap, last.get_heap());
mds->mlogger->set(l_mdm_malloc, last.malloc);

This comment has been minimized.

@jcsp

jcsp Feb 22, 2017

Contributor

This was the only use of l_mdm_malloc, so please remove the definition as well.

@jcsp

This comment has been minimized.

Contributor

jcsp commented Feb 22, 2017

This looks fine to me apart from the comment about l_mdm_malloc -- regarding the heap calculation part, I guess that doesn't affect the validity of this PR itself?

common/MemoryModel: Bump int to long and drop mallinfo
mallinfo(3) doesnt have 64bit compatible version so when
malloc size > 4GB, either wrapped value or a negtive value
returned, which is really misleading.

Also bump up all int to long to prevent overflow oneday we
have > 2TB memory.

Signed-off-by: Xiaoxi Chen <xiaoxchen@ebay.com>
@xiaoxichen

This comment has been minimized.

Contributor

xiaoxichen commented Feb 22, 2017

@jcsp addressed.
Yes the heap calculation doesnt affect this pr, just another discussion about the correctness or usage of head calculation, as I always see tiny values ( "heap": 166284) .

@xiaoxichen

This comment has been minimized.

Contributor

xiaoxichen commented Mar 2, 2017

@jcsp mind take another look?

@jcsp

jcsp approved these changes Mar 8, 2017

@jcsp jcsp merged commit e915e0f into ceph:master Mar 8, 2017

3 checks passed

Signed-off-by all commits in this PR are signed
Details
Unmodifed Submodules submodules for project are unmodified
Details
default Build finished.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment