Re: Can i allocate 4GB virtual addresses (more than a certain limit) using vmalloc?

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

 



Hi Dave,

>Also keep in mind that when you vmalloc stuff you're allocating in
>units of pages, and there is a guard page between each allocation. So
>if you had 512 Mb of virtual space (which is 131,072 pages), you'll be
>able to vmalloc a maximum of 65536 objects or 1 page each. Fewer
>objects if they're bigger than a page.

A quick question, Suppose if I alloc 1MB of memory using vmalloc,Is there a guard page between each page or is it after the 1MB.

With Regards,
Subin K G




On Tue, May 31, 2011 at 10:19 AM, Dave Hylands <dhylands@xxxxxxxxx> wrote:
Hi Sandeep,

On Mon, May 30, 2011 at 10:54 PM, sandeep kumar
<coolsandyforyou@xxxxxxxxx> wrote:
> Hi all,
> The following link gives the memory map for the arm architecture.
> http://www.arm.linux.org.uk/developer/memory.txt
>
> I have the following doubts..
> 1) Any chipset(based on arm) manufacturer(qualcom,samsung..) should follow
> the same memory map.
> Is it hardly constrained or can be changed?
> Where are this constraints are implemented in the kernel source tree?

You can have 2 different configurations for the same chip which
present totally different memory maps. Where things are physically in
memory varies from chip to chip, regardless of the fact that they
happen to use the same processor.

> 2) while i was student, i read in OS concepts that, "Virtual memory gives an
> illusion to a process,
> that it has always a larger continuous address space (even more than RAM)
> available to it."
> So i thought i could allocate howmuch ever memory i want.
> But seeing the above link,i observed there is some limitation in the address
> space created by the vmalloc().
> So i m now thinking that vmalloc has some limit.

Absolutely. You can only vmalloc as much memory as there is virtual
space reserved for vmalloc. And your vmalloc memory space can become
fragmented, so you could have lots of space, but not have enough
contiguous virtual space left to allocate a large object.

Also keep in mind that when you vmalloc stuff you're allocating in
units of pages, and there is a guard page between each allocation. So
if you had 512 Mb of virtual space (which is 131,072 pages), you'll be
able to vmalloc a maximum of 65536 objects or 1 page each. Fewer
objects if they're bigger than a page.

The actual allocation of vmalloc memory is determined by the macros
VMALLOC_START and VMALLOC_END. VMALLOC_START is defined in
arch/arm/include/asm/pgtable.h:
http://lxr.linux.no/linux+v2.6.39/arch/arm/include/asm/pgtable.h#L41
although it can be overriden by a particular architecture.

VMALLOC_END is normally defined in the machine's memory.h file, and it
sits somewhere between VMALLOC_START and the beginning of I/O space.

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

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



--
With Regards
Subin Gangadharan

Everything should be made as simple as possible,but not simpler.

_______________________________________________
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