Hi! How can I figure out amount of a process' "locked" memory?

From: Igor Podlesny
Date: Sun May 03 2009 - 13:28:02 EST


Sorry for asking here, but Googled no real answer. There's
/usr/bin/pmap with its man-page saying that "-x" option would tell
some "extended" info, but alas, it just outputing "-" instead of real
values.

Tried to test that using simple C program named "ml.c":

#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>

int main(int ac, char *av[])
{
const size_t alloc_size = 45 * 1024 * 1024;
char *buf = malloc(alloc_size);
if (mlock(buf, alloc_size) ) {
perror("mlock");
}

getchar();

return (0);
}

And pmap -x on that test process shows:

Address Kbytes RSS Anon Locked Mode Mapping
0000000000400000 4 - - - r-x-- ml
0000000000600000 4 - - - rw--- ml
00007f9686000000 46080 - - - rw--- [ anon ]
00007f9688d00000 2048 - - - rw--- [ anon ]
[...]
---------------- ------ ------ ------ ------
total kB 66976 - - -

It seems no information under corresponding /proc/PID can provide the
answer too, at least maps/smaps don't have something related to the
"locked" attribute.

uname -rm: 2.6.29.2-64-1KHz-fst-ldbg x86_64
/lib/libc.so.6: GNU C Library stable release version 2.9, by Roland
McGrath et al.

Thanks in advance,

--
End of message. Next message?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/