Re: Upgrading problem with my /proc/pid/smaps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I figured out where is the problem.

It is a function I implemented for kernel 2.6.1, but
does not work for 2.6.9. The function below throws the
segmentation fault.

Here is the function:

void resident_mem_size(struct mm_struct *mm, unsigned
long start_address, unsigned long end_address,
unsigned long *size) {
	pgd_t *my_pgd;
	pmd_t *my_pmd;
	pte_t *my_pte;
	unsigned long page;

	for (page = start_address; page < end_address; page
+= PAGE_SIZE) {
		my_pgd = pgd_offset(mm, page);
		if (pgd_none(*my_pgd) || pgd_bad(*my_pgd)) continue;
		my_pmd = pmd_offset(my_pgd, page);
		if (pmd_none(*my_pmd) || pmd_bad(*my_pmd)) continue;
		my_pte = pte_offset_map(my_pmd, page);
		if (pte_present(*my_pte)) {
			*size += PAGE_SIZE;
		}
	  }
}

Does anyone know what is going on?

Mauricio Lin.

 --- Mauricio Lin <mauriciolin2000@xxxxxxxxxxxx>
escreveu: 
> Hi All,
> 
> I have implemented a new entry in proc directory in
> kernel 2.6.1. It is something similar to
> /proc/pid/maps. The new entry is /proc/pid/smaps
> where
> pid is the process id. It is working well on kernel
> 2.6.1.
> 
> I decided to upgrade it to kernel 2.6.9, but
> something
> is going wrong when I type de cat command.
> 
> $ cat /proc/3477/smaps
> 
> b68ed000-b68ee000 rw-p  /usr/lib/kde3/kded_kinetd.so
> VmRss:       4 kB
> VmData:       0 KB
> VmStk:       0 kB
> VmExe:       0 kB
> VmLib:       0 kB
> Shared:       0 kB
> Private:       4 kB
> Shareable:       0 kB
> b68ee000-b68ff000 r--p 
>
/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf
> VmRss:      68 kB
> VmData:       0 KB
> VmStk:       0 kB
> VmExe:       0 kB
> VmLib:       0 kB
> Shared:       0 kB
> Private:      68 kB
> Shareable:       0 kB
> 
> ....
> 
> b7fea000-b8000000 r-xp  /lib/ld-2.3.2.so
> VmRss:      80 kB
> VmData:       0 KB
> VmStk:       0 kB
> VmExe: Segmentation fault
> 
> As you can see, the segmentation fault is displayed
> at
> the end of the output. This problem does not have
> for
> kernel 2.6.1.
> 
> The files I changed are fs/proc/base.c and
> fs/proc/task_mmu.c on kernel 2.6.1. AFAIK this files
> were not changed since 2.6.1. So what is going on
> with
> kernel 2.6.9?
> 
> BR,
> 
> Mauricio Lin.
> 
> =====
> ************************************************
>   Conhecimento vem do seu instrutor; 
>   Sabedoria vem do seu interior.  
>   (Bruce Lee)             
> ************************************************
> 
> 
> 	
> 	
> 		
>
_______________________________________________________
> 
> Yahoo! Acesso Grátis - Internet rápida e grátis.
> Instale o discador agora!
> http://br.acesso.yahoo.com/
> 
> --
> Kernelnewbies: Help each other learn about the Linux
> kernel.
> Archive:      
> http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
>  

=====
************************************************
  Conhecimento vem do seu instrutor; 
  Sabedoria vem do seu interior.  
  (Bruce Lee)             
************************************************


	
	
		
_______________________________________________________ 
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora! http://br.acesso.yahoo.com/

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux