On 8/25/06, Suman Adak <ilugsuman@xxxxxxxxx> wrote:
Sorry , i forgot to send list also....
On 8/24/06, Sundar SM <mee.sundar@xxxxxxxxx> wrote:
Hi Friends
1) What is the range of the running kernel stack in main memory?
look at /proc interface.
cat /proc/iomem | grep -i 'kernel data'. You would get the address range.
2) How can you find out size of kernel sapce and user space in your main
memory?
Do u mean virtual memory? if yes just check this code
main()
{
char *ch = getenv("HOME");
if((unsigned long)ch > (unsigned long)(0x7FFFFFFF))
printf("3/1 GB split\n");
else
printf("2/2 GB split\n");
}
you can enable memory_accounting option in kernel configuration. User space
memory can be calculated using sum of (pmap <each pid from /proc> | grep -i
'total'). U can write a small script to calculate the total user space. But
remind it will not give you the actual size.
If u want to write a kernel module , then u can do like...by manipulating
(task_struct,mm_struct,vm_area_struct). You could pass the PID from /proc
interface
as a parameter and manipulate the total size.
3) How to find the avialable kernel / user space and used kernel / user
space? is there any shell command to see that?
cat /proc/meminfo
I am also learning kernel programming. if i do mistake please correct me.