user space vs kernel space address space
Pritam Bankar
pritambankar1988 at gmail.com
Mon Dec 30 09:28:13 EST 2013
Miles thanks a lot for response but I still have some doubts please see my
comments inline.
On Sun, Dec 29, 2013 at 7:04 PM, Miles MH Chen <orca.chen at gmail.com> wrote:
> Hi Pritam,
>
> 1) Yes, all 512RAM will be direct mapped to kernel address space IF the
> kernel have a 896MB direct mapping area.
> Actually you can change the range of kernel direct mapping by the
> vmalloc=<size> in boot command line.
> In 32-bit and 3:1 split configuration, kernel direct mapping area +
> vmalloc area is roughly 1G.
>
> 2) User space and kernel space can have different virtual addresses
> mapping to the same physical frame at the same time.
>
> 3) Direct mapped or fixed map or permanent map are describing kernel
> VIRTUAL address space, you can see the virtual memory
> layout by 'dmesg'. When user space needs memory, the kernel allocates a
> free memory frame, and remaps the frame to user space.
> The frame does not have to have a valid kernel virtual address.
>
>
But all physical memory/frames are eventually controlled by kernel , then
how can there ever exist a frame which doesn't have mapping with kernel or
kernel virtual address ?
> Regards,
> MH
>
>
> On Sun, Dec 29, 2013 at 5:42 PM, Pritam Bankar <pritambankar1988 at gmail.com
> > wrote:
>
>> Lets consider 32 bit Linux system with 512 physical RAM. Suppose I have
>> standard 3:1 address space split. Now what I understand is
>>
>> (In general)
>> 1. In the fourth gigabyte I have kernel space
>> 2. Out of 1GB for kernel address space only 896MB is used as direct
>> mapping and other 128 MB is used for Noncontiguous Memory Area Management,
>> Fixed Mapping and Permanent Mapping.
>>
>> PCMIIW
>>
>> Following are my doubts :
>> 1. Since my system has only 512MB RAM, will there be only direct mappings
>> since 896 is enough to hold 512 RAM?
>> 2. When user space program do malloc, we get some virtual address from
>> userspace region (from first 3GB) of process. So will it be like, when I
>> access some memory from that region, there is some physical frame
>> associated with it AND same physical frame will also be mapped in kernel
>> space ?
>> So what I want to know, for every physical frame is there a mapping in
>> userspace as well as kernel space ? (given that some address in user space
>> of process map to same physical frame)
>> 3. If we consider example of Linux system with 4GB, now if I do malloc
>> from user space from which memory region kernel will give memory ? Direct
>> mapped region or fixed map or permanent map ?
>>
>> Thanks and regards,
>> Pritam Bankar
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>
Thanks and regards,
Pritam Bankar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20131230/ea3e75ea/attachment.html
More information about the Kernelnewbies
mailing list