[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unity mapping in kernel area?
one more thing good to know is the importance/reasons for
ZONE_HIGHMEM. Whenever process swap between userspace and
kernelspace processing, Linux Kernel is designed NOT to do TLB
flushing - and this means that the pagetable must not be modified.
In 3G/1G memory division, pagetables for these users tasks must exists
inside the 1G kernel portion. But of these about 850KB is occupied
by the ZONE_NORMAL, and the remaining is used for pagetables and misc
structures.
To be noted is also that these VMA-mapped memory are always temporary
(readup: kmap()). Most the standard kernel functions will
automatically use identity-mapped memory, which can access ZONE_NORMAL
memory only.
Check this out:
http://ols.fedoraproject.org/OLS/Reprints-2004/Reprint-Bottomley-OLS2004.pdf
On Tue, Mar 3, 2009 at 3:43 PM, Peter Teoh <htmldeveloper@xxxxxxxxx> wrote:
> - Show quoted text -
> On Tue, Mar 3, 2009 at 2:41 PM, NAHieu <nahieu@xxxxxxxxx> wrote:
>> On Tue, Mar 3, 2009 at 3:29 PM, Peter Teoh <htmldeveloper@xxxxxxxxx> wrote:
>>> - Show quoted text -
>>> On Tue, Mar 3, 2009 at 11:39 AM, NAHieu <nahieu@xxxxxxxxx> wrote:
>>>> On Tue, Mar 3, 2009 at 12:16 PM, Peter Teoh <htmldeveloper@xxxxxxxxx> wrote:
>>>>> This is the first time I have seen the word "unity-mapping"......if it
>>>>> is your invention....congratulations!!!! U have created a new term.
>>>>
>>>> so you learned a new term today :-). but i agree that it is not
>>>> popular, and it confused me at first.
>>>>
>>>> so the more popular one is "identity mapping", right?
>>>>
>>>> that is not my term, but somebody else. I read that on internet somewhere ...
>>>>
>>>>>
>>>>> 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.
>>>>
>>>> OK, so the difference between kmalloc and vmalloc in term of address
>>>> they return:
>>>> - kmalloc() always return addresses in ZONE_NORMAL
>>>> - vmalloc() always returns addresses in ZONE_HIGH
>>>>
>>>> Could you confirm that is correct?
>>>
>>> to the best of my knowledge....i think yes.
>>>
>>>>
>>>> So my question now is: what is ZONE_NORMAL range? I mean from what
>>>> address to what address?
>>>>
>>>
>>> eh.....check header file definition......it varies from arch to arch,
>>> and may be modified at bootup time via some parameter as well. but
>>> don't have to know either - cannot find any reason for that. can i
>>> know why did u ask?
>>
>> I am working on a tool to analyze the kernel memory, so I need to
>> understand how kernel manages and layouts its memory.
>>
>
> analyze the memory for what? patterns of allocation? patterns of
> API usages? or performance analysis of different APIs used?
>
>
> --
> Regards,
> Peter Teoh
>
--
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