Re: Page table queries

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

 





On Sat, Feb 19, 2011 at 2:44 PM, Rajat Sharma <fs.rajat@xxxxxxxxx> wrote:
> So, in the start, the page might have kernel mode address, but in the
> end it has user mode address. But kernel is still the one that tracks
> all the page...be it anonymous or non anonymous ones.

Not really. In this particular case of .nopage (page fault handler) of
vma, we already have a user space virtual address for the faulty page,
we just need it to map it with a physical page frame (RAM or device
memory). Just allocate a physical page frame without any address,
caller for .nopage will take care of properly setting its user space
virtual address (page->va). So, no association with kernel space
virtual address is required, e.g. it can be high memory page too
without any kernel mapping.

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?
Rajat

On Sat, Feb 19, 2011 at 2:10 PM, Mulyadi Santosa
<mulyadi.santosa@xxxxxxxxx> wrote:
> Hi :)
>
> I'll try to help...
>
> On Sat, Feb 19, 2011 at 13:10, anish singh <anish198519851985@xxxxxxxxx> wrote:
>> As i understoodÂwhenver a user space program is run it is represented in
>> kernel using VMA which is managed by struct mm_struct
>> and whenever the program is trying to read/write to a memory location in
>> user space it will be directed to physical address using PAGE TABLE
>> translation done by struct mm_struct(done in kernel space).Am i right?
>
> i think not "done" but mm_struct points to PGD that represent's the
> whole process address space. Using information provided there, MMU
> does translation.
>
>> SupposeÂa simple driver wantsÂtheÂuser to directly access its device memory
>> thenÂwe use mmap.This mmapÂassociates a set of user space virtual address
>> withÂdevice driver memory and it is done by creating kernel page tables for
>> the user space virtual addresses.Is the page table translation done
>> everytime whenever user spaceÂdoes read/write to the device memory??
>
> if it's recently translated, quite likely it is already cached in TLB
> (translation look aside buffer)
>
>> In .nopage functionÂcall we return the page associatedÂwith the physical
>> address which the user wants to associate with user spaceÂvirtual address.Is
>> the pageÂaddressÂreturned by the nopage function same asÂseen by the user or
>> will it be converted to user space virtual address(range between 0-2 GB)?
>
> AFAIK, nopage is one of the functions that handle minor page fault, no?
>
> Anyway, memory allocation, usually start by kernel allocates a page.
> Then it is "handed" to user space memory allocator.
>
> So, in the start, the page might have kernel mode address, but in the
> end it has user mode address. But kernel is still the one that tracks
> all the page...be it anonymous or non anonymous ones.
>
> Does it help? :)
>
>
>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer and consultant
>
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@xxxxxxxxxxxxxxxxx
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[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