Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
Results 11 to 12 of 12
Like Tree3Likes
As example, when booting check the Kernel Virtual Memory layout. Using latest stable kernel on BeagleBone board: Virtual kernel memory layout: [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Just Joined!
    Join Date
    May 2011
    Location
    Brazil
    Posts
    21

    As example, when booting check the Kernel Virtual Memory layout. Using latest stable kernel on BeagleBone board:

    Virtual kernel memory layout:
    [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
    [ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
    [ 0.000000] vmalloc : 0xd0800000 - 0xff000000 ( 744 MB)
    [ 0.000000] lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
    [ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
    [ 0.000000] .text : 0xc0008000 - 0xc06bd000 (6868 kB)
    [ 0.000000] .init : 0xc06bd000 - 0xc06fc000 ( 252 kB)
    [ 0.000000] .data : 0xc06fc000 - 0xc0745520 ( 294 kB)
    [ 0.000000] .bss : 0xc0745544 - 0xc0786e9c ( 263 kB)

    Leví

  2. #12
    Linux Enthusiast Bemk's Avatar
    Join Date
    Sep 2008
    Location
    Oosterhout-NB, Netherlands
    Posts
    525
    Quote Originally Posted by hazel View Post
    I was always told that virtual memory operates like this: the kernel tracks down all the code and data that a process will require (inside the executable, in libraries and elsewhere), adds it up and divides it into pages. Then it copies individual pages into core when the cpu requests them by raising a page fault.

    But I was also told that the whole kernel must be in core all the time because there is nothing "behind" the kernel that could copy kernel pages from virtual memory into core. So how can the kernel itself use virtual memory?
    To a kernel using virtual memory is exactly the same as using virtual memory. There are even advantages to using virtual memory, as the kernel can even swap out bits it doesn't need if the need is really high (my memory tracker has options of marking pages as swappable).

    All the kernel has to do, at boot time, is map its data to some virtual place, switch to virtual memory, jump up to its new virtual location, and clean up the mess in the range where its physical addresses were mapped to the virtual ones linearly, in order to make the jump possible.

    From that moment on, whenever the kernel needs a physical address for say, page tables or a driver HAS to use some range of memory (don't say this doesn't happen), these locations are just mapped into virtual memory, from virtual memory, and referenced from there.

    As for the original question of "will the allocation fail?" the answer is depends on the system and its kernel build.

    In general on x86 it will fail, because the kernel only has 1 GB of virtual memory to play with. On EM32T however, I think the kernel has 2 gigs of virtual memory to play with, so it won't fail there ...

    Anyways, on higher half stuff and virtual memory is some pretty fun (though maybe overly complex) stuff out there.
    Operating Systems Development Series
    What is virtual memory? | Orion
    Higher Half Kernel - OSDev Wiki
    Paging - OSDev Wiki
    Full time computer science student, spare time OS developer.
    @bemk92 on twitter.

Page 2 of 2 FirstFirst 1 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •