Re: kernel VM area issue

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

 



Hi,

Note that my answer does not take into account the handling of high memory in the Linux 2.4.x kernel (which I don't understand yet). It is based on my undestanding of the
Linux 2.2.x kernel

As far as I know, there are no VM areas for kernel memory. Kernel pointers fall into two classes:

1) They may be within the start region of kernel virtual addresses (the addresses between PAGE_OFFSET and PAGE_OFFSET + size of physical memory). This region provides a 1:1
mapping between physikal and (kernel) virtual addresses, phys_to_virt() and virt_to_phys() provide conversion between (kernel) virtual addresses from this region and
physikal addresses.

As far as I know, there is no higher level structure (such as vm_area structures) describing areas within this region of virtual addresses.

virtual addresses within this region are returned e.g. by kmalloc() or __get_free_pages().

2) They may be from the region above PAGE_OFFSET + size of physical memory. Addresses in this region are mapped through page tables onto physical memory (if they are mapped
- they don't need to be). Pointers of this class are returned by vmalloc().

Areas within this second region are described by a descriptor of type struct vm_struct (which contains flags, start address, size and a pointer to the next descriptor).
Those descriptors are linked into a list called vmlist. However, as far as I know, this list is not exported by the kernel, i.e. you can't access it from a module (but I
don't think you should need access to it either).

regards
Martin

Fabrice Tchakountio wrote:

> Hi all -
>
> My name is Fabrice. I'm currently working on Linux 2.4.2 kernel which is
> part of Red-Hat 7.1 package. I'm hacking on the VM system of Linux.
> My question is:
> Given a kernel pointer ( pointer to a given kernel data structure),  how
> can we find the appropriate VM area instance?
>
> for a userland pointer , we can do:
>
>         u_vma=find_vma(current->mm, u_ptr)
>
> Thanks
> Fabrice
>
> -
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> IRC Channel:   irc.openprojects.net / #kernelnewbies
> Web Page:      http://www.kernelnewbies.org/

--
Supercomputing System AG          email: maletinsky@scs.ch
Martin Maletinsky                 phone: +41 (0)1 445 16 05
Technoparkstrasse 1               fax:   +41 (0)1 445 16 10
CH-8005 Zurich


-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[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