Re: unity mapping in kernel area?

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

 



This is the first time I have seen the word "unity-mapping"......if it
is your invention....congratulations!!!! U have created a new term.

Usually I heard of "identity mapping", "direct mapping", linear
mapping, vs "non-linear mapping".   The formula is basically
equivalent to __pa(), and all the different variation:  __va(),
virt_to_page(), pfn_to_kaddr() etc.   It is all just using a
straightforward formula.   This is because virtual address and
physical addr are inter-convertible directly in the ZONE_NORMAL range.
  But not in the ZONE_HIGH area.   kmalloc() always returned addresses
in these range.   All the confusing API like pud*, pgd*, pmd*() API
also hinges on this characteristic to convert directly between
physical and virtual, or to extract out page frame number, PTE etc
from the virtual/physical addresses.

When u learn identity mapping, it really helped to know versus what?
Ie, what are the other mapping available?   And this is where
vmalloc() comes in.   It returned addresses in the ZONE_HIGH area,
where kernel modules are loaded as well.   The mappings are kept in
the task-specific VMA linked list (list head is at current->mm) or
anonymous memory's head (at anon_vma->head).   Conversion between
physical and virtual is a bit more difficult, where u really have to
walk through the VMA lists or the reverse mapping lists to search for
answer.

Other variations (quoted from a book):

Persistent mappings are used to map non-persistent pages from the
highmem area into the kernel.

Fixmaps are virtual address space entries associated with a fixed but
freely selectable page in physical address space. In contrast to
directly mapped pages that are associated with RAM memory by means of
a fixed formula, the association between a virtual fixmap address and
the position in RAM memory can be freely defined and is then always
observed by the kernel.

Current work:

vmap() reworking:
http://lwn.net/Articles/304188/

have fun!!!!

Yours Confusingly,
Peter Teoh

On Mon, Mar 2, 2009 at 9:42 AM, NAHieu <nahieu@xxxxxxxxx> wrote:
> Sorry that I accientally pushed the button before completing email. So
> the full message is like below.
>
> Hi,
>
> In Linux kernel, we have unity-mapping feature, which maps the virtual
> addresses in kernel area (above PAGE_OFFSET) to physical addresses in
> the format:
>       y = x - PAGE_OFFSET
>
> in which "y" is physical address corresponding to the virtual address "x"
>
> I understand that this unity-mapping is correct with all the virtual
> addresses in the range of [PAGE_OFFSET, ZONE-NORMAL\ area.
>
> Is that assumption correct?
>
> Thanks a lot,
> H
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>



-- 
Regards,
Peter Teoh

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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