Skip to contentSkip to conversation

kmalloc -contiguous locations ?

LKML Shobhit Mathur 2 participants 2 messages May 31, 2004

lore
Share & tools
lore
#0 lore raw

Hello,

I would like to know whether kmalloc() guarantees virtually contiguous memory locations ?
Is there a limit on the amount of contiguous memory that can be returned by kmalloc() ?

- Thank you

- Shobhit Mathur

__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 6 lines · Shobhit Mathur

Hello,

I would like to know whether kmalloc() guarantees virtually contiguous memory locations ?
Is there a limit on the amount of contiguous memory that can be returned by kmalloc() ?

First, kmalloc returns physically contiguous memory.
second, the limit (on x86) is 128kb (32 pages), allocatable in powers of two
pages. (1,2,4,8,16,32. often called 0-order thru 5-order allocations)

vmalloc returns virtual contiguous allocations, with no guarantee on physical
contiguity. The problem with vmalloc, iirc, is that there's a [total] limit of 128MB for vmallocs.

Also remember that all kernel memory allocated with vmalloc() or kmalloc() is
non-swappable.

I don't know how this changes under any other architecture, such as x86-64 or
PPC32/64.

Quoted 4 lines

- Thank you

- Shobhit Mathur

- --
tabris
- -
A master was explaining the nature of Tao to one of his novices.
"The Tao is embodied in all software -- regardless of how insignificant," said the master.
"Is Tao in a hand-held calculator?" asked the novice. "It is," came the reply.
"Is the Tao in a video game?" continued the novice. "It is even in a video game," said the master.
"And is the Tao in the DOS for a personal computer?" The master coughed and shifted his position slightly. "The lesson
is over for today," he said.
-- Geoffrey James, "The Tao of Programming"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAu76V1U5ZaPMbKQcRAh8MAJ4nXgcFr/AENZql4BDFIRL+HGGJzACeNqej TPVXSEF6E0ud+MfA8g5tQqE=
=sgpU
-----END PGP SIGNATURE-----