<br><br>
<div class="gmail_quote">On Sat, Feb 19, 2011 at 2:44 PM, Rajat Sharma <span dir="ltr"><<a href="mailto:fs.rajat@gmail.com">fs.rajat@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div class="im">> So, in the start, the page might have kernel mode address, but in the<br>> end it has user mode address. But kernel is still the one that tracks<br>> all the page...be it anonymous or non anonymous ones.<br>
<br></div>Not really. In this particular case of .nopage (page fault handler) of<br>vma, we already have a user space virtual address for the faulty page,<br>we just need it to map it with a physical page frame (RAM or device<br>
memory). Just allocate a physical page frame without any address,<br>caller for .nopage will take care of properly setting its user space<br>virtual address (page->va). So, no association with kernel space<br>virtual address is required, e.g. it can be high memory page too<br>
without any kernel mapping.<br><br></blockquote>
<div>so after the setting of user space virtual address the physical memory can be directly addreseed by just doing a page table translation in user space and kernel doesn't need to be involved.As it has already created the page table and returned the corresponding page.Am i right?</div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Rajat<br>
<div>
<div></div>
<div class="h5"><br>On Sat, Feb 19, 2011 at 2:10 PM, Mulyadi Santosa<br><<a href="mailto:mulyadi.santosa@gmail.com">mulyadi.santosa@gmail.com</a>> wrote:<br>> Hi :)<br>><br>> I'll try to help...<br>><br>
> On Sat, Feb 19, 2011 at 13:10, anish singh <<a href="mailto:anish198519851985@gmail.com">anish198519851985@gmail.com</a>> wrote:<br>>> As i understood whenver a user space program is run it is represented in<br>
>> kernel using VMA which is managed by struct mm_struct<br>>> and whenever the program is trying to read/write to a memory location in<br>>> user space it will be directed to physical address using PAGE TABLE<br>
>> translation done by struct mm_struct(done in kernel space).Am i right?<br>><br>> i think not "done" but mm_struct points to PGD that represent's the<br>> whole process address space. Using information provided there, MMU<br>
> does translation.<br>><br>>> Suppose a simple driver wants the user to directly access its device memory<br>>> then we use mmap.This mmap associates a set of user space virtual address<br>>> with device driver memory and it is done by creating kernel page tables for<br>
>> the user space virtual addresses.Is the page table translation done<br>>> everytime whenever user space does read/write to the device memory??<br>><br>> if it's recently translated, quite likely it is already cached in TLB<br>
> (translation look aside buffer)<br>><br>>> In .nopage function call we return the page associated with the physical<br>>> address which the user wants to associate with user space virtual address.Is<br>
>> the page address returned by the nopage function same as seen by the user or<br>>> will it be converted to user space virtual address(range between 0-2 GB)?<br>><br>> AFAIK, nopage is one of the functions that handle minor page fault, no?<br>
><br>> Anyway, memory allocation, usually start by kernel allocates a page.<br>> Then it is "handed" to user space memory allocator.<br>><br>> So, in the start, the page might have kernel mode address, but in the<br>
> end it has user mode address. But kernel is still the one that tracks<br>> all the page...be it anonymous or non anonymous ones.<br>><br>> Does it help? :)<br>><br>><br>><br>> --<br>> regards,<br>
><br>> Mulyadi Santosa<br>> Freelance Linux trainer and consultant<br>><br>> blog: <a href="http://the-hydra.blogspot.com/" target="_blank">the-hydra.blogspot.com</a><br>> training: <a href="http://mulyaditraining.blogspot.com/" target="_blank">mulyaditraining.blogspot.com</a><br>
><br></div></div>> _______________________________________________<br>> Kernelnewbies mailing list<br>> <a href="mailto:Kernelnewbies@kernelnewbies.org">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><br>_______________________________________________<br>Kernelnewbies mailing list<br><a href="mailto:Kernelnewbies@kernelnewbies.org">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>
</blockquote></div><br>