Re: vmalloc size

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

 



Hi,

On Mon, Jun 25, 2012 at 9:01 PM, 卜弋天 <buyit@xxxxxxx> wrote:
>
>> Suppose your machine has 1 GB of RAM with a physical addresses of
>> 0x40000000 thru 0x7FFFFFFF
>>
>> Let's suppose that PHYS_OFFSET = 0xC0000000
>> Let's suppose that VMALLOC_START is set to 0xE0000000 and VMALLOC_END
>> is at 0xEFFFFFFF (256 Mb)
>>
> is this PAGE_OFFSET or PHYS_OFFSET?

PAGE_OFFSET is a virtual address, and PHYS_OFFSET is a physical
address, so you are correct. That should have been PAGE_OFFSET.

>> So what we have is that memory from 0xC0000000 thru 0xDFFFFFFF (512
>> Mb) is kernel direct mapped memory and maps to physical addresses
>> 0x40000000 thru 0x5FFFFFFF
>>
>> Physical memory from 0x60000000 thru 0x7FFFFFFF (512Mb) is considered
>> high-mem. For the most part this is only usable by user-space. From
>> kernel space, you need to use the kmap/kunmap functions to even access
>> the memory.
>>
> i don't think high-memory is only used by user-space.
> vmalloc() funciton will try to allocate physical memory from high_memory
> first, if there is no high_memory, then allocate from normal region.

That also seems to be correct. The code in vmalloc that calls the
underlying page allocator passes in __GFP_HIGHMEM, so it will try to
use highmem for vmalloc'd pages.

>> However, if you call vmalloc and lets suppose that vmalloc just
>> happens to return 0xE0000000. The physical address of the first page
>> might be 0xD2345000.
>>
> suppose vmalloc() return 0xE0000000, which is the VMALLOC_START, then the
> physical memory address
> should be 0x60000000 thru 0x7FFFFFFF in your example.
>
>
>> What's important is that the physical pages which back up the vmalloc
>> area all come from the kernel direct mapped area. They won't ever be
>> backed by pages from high-memory. So the physical addresses will all
>> be in the range 0x40000000 thru 0x5FFFFFFF.
>>
> what do you mean "back up", maybe i have some misunderstanding.
> in my opnion, vmalloc area should map to physical address 0x60000000 thru
> 0x7FFFFFFF first,
> if this resion is exhausted, then normal area will be allocated.

By backed-by, I meant the associated physical page. I was incorrect in
saying that only lowmem pages would be used.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

_______________________________________________
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