<div dir="ltr">Thanks Miles, I was in assumption that every physical HAS to be mapped in some kernel virtual address. I have come across one more doubt please see my comments inline.<div class="gmail_extra"><br clear="all">
<div><br></div><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">
<div><br></div></div><div class=""><div class="h5"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra">
<br><br><div class="gmail_quote"><div>On Sun, Dec 29, 2013 at 7:04 PM, Miles MH Chen <span dir="ltr">&lt;<a href="mailto:orca.chen@gmail.com" target="_blank">orca.chen@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div dir="ltr"><div><div><div><div><div><div><div>Hi Pritam,<br><br></div>1) Yes, all 512RAM will be direct mapped to kernel address space IF the kernel have a 896MB direct mapping area.<br></div>Actually you can change the range of kernel direct mapping by the vmalloc=&lt;size&gt; in boot command line.<br>



</div>In 32-bit and 3:1 split configuration, kernel direct mapping area + vmalloc area is roughly 1G.<br><br></div>2) User space and kernel space can have different virtual addresses mapping to the same physical frame at the same time.<br>



<br></div></div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></blockquote><div><br></div><div>            How above scenario of user space and kernel space having mapping to the same physical frame               is handled. This would be like sharing kernel data with user which is not allowed. </div>
<div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">
<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">
<div class="gmail_extra"><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">
<div><div><div></div>3) Direct mapped or fixed map or permanent map are describing kernel VIRTUAL address space, you can see the virtual memory<br>layout by &#39;dmesg&#39;. When user space needs memory, the kernel allocates a free memory frame, and remaps the frame to user space. <br>



The frame does not have to have a valid kernel virtual address. </div><div><br></div></div></div></blockquote><div> </div><div><br></div></div><div>But all physical memory/frames are eventually controlled by kernel , then how can there ever exist a frame which doesn&#39;t have mapping with kernel or kernel virtual address ?</div>

<div>
<div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">

<div>
<div></div>Regards, <br></div>MH<br></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Sun, Dec 29, 2013 at 5:42 PM, Pritam Bankar <span dir="ltr">&lt;<a href="mailto:pritambankar1988@gmail.com" target="_blank">pritambankar1988@gmail.com</a>&gt;</span> wrote:<br>



</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><div dir="ltr"><div>Lets consider 32 bit Linux system with 512 physical RAM. Suppose I have standard 3:1 address space split. Now what I understand is</div>



<div> </div><div>(In general)</div><div>1. In the fourth gigabyte I have kernel space</div>
<div>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.</div><div><br></div><div>PCMIIW</div>




<div><br></div><div>Following are my doubts :   </div>1. Since my system has only 512MB RAM, will there be only direct mappings since 896 is enough to hold 512 RAM?<div>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 ?</div>




<div>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) </div><div>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 ?<br>




<div> <br clear="all"><div>Thanks and regards,<br>Pritam Bankar</div>
</div></div></div>
<br></div></div>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br></div></blockquote><div><br></div><div><br></div>Thanks and regards,<br><div>Pritam Bankar </div></div></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>