Questions tagged [vmalloc]
34 questions
130
votes
8 answers
What is the difference between vmalloc and kmalloc?
I've googled around and found most people advocating the use of kmalloc, as you're guaranteed to get contiguous physical blocks of memory. However, it also seems as though kmalloc can fail if a contiguous physical block that you want can't be…

FreeMemory
- 8,444
- 7
- 37
- 49
10
votes
3 answers
Is there a size limit for kernel module in linux?
I have a problem loading a kernel module, there is a large data structure, around the size of 2Gb of memory - whether I preallocate the table (so that it shows in .bss when I do size -A module.ko or try to vmalloc() it at load time, the module…

Kimvais
- 38,306
- 16
- 108
- 142
5
votes
0 answers
understanding the physical and virtual memory layout in my kernel
I have a dragonboard410c which is based on arm64 and when it boots , it shows the memory layout:
software IO TLB [mem 0xb6c00000-0xbac00000] (64MB) mapped at [ff]
Memory: 780212K/951296K available (9940K kernel code, 1294K rwda)
Virtual kernel…

dafnahaktana
- 837
- 7
- 21
5
votes
2 answers
Porting module to newer Linux kernel: Cannot allocate memory
I have a quite big driver module that I am trying to compile for a recent Linux kernel (3.4.4). I can successfully compile and insmod the same module with a 2.6.27.25 kernel.
GCC version are also different, 4.7.0 vs 4.3.0. Note that this module is…

calandoa
- 5,668
- 2
- 28
- 25
4
votes
0 answers
How kmalloc() and vmalloc() used in 32bit vs 64bit systems?
Architecture: X86, Linux
I have gone through several threads related to kmalloc() and vmalloc() and I know the basic differences between them but still have some doubts. I need your help to understand the fundamentals.
So As we know that in 32-bit…

Usr1
- 369
- 1
- 6
- 15
4
votes
1 answer
vmalloc_to_pfn returns 32 bit address on Linux 32 system. Why does it chop off higher bits of PAE physical address?
I'm using vmalloc_to_pfn() to get the physical address on a 32-bit PAE Linux system. It looks like vmalloc_to_pfn() returns "unsigned long" which means it is 32 bit on a 32 bit system, 64 bit on a 64-bit system. On 64-bit Linux, unsigned long is 64…

asmprogrammer
- 71
- 3
3
votes
1 answer
How to allocate executable memory in Linux
Since the release of the Linux 5.8 kernel the signature of *__vmalloc() has changed from:
void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
To this
void *__vmalloc(unsigned long size, gfp_t gfp_mask)
Which means you cannot…

Xander
- 418
- 2
- 12
3
votes
0 answers
vmalloc - update page tables of a another process on a page fault
I was reading Mel Gorman's book Understanding the Linux Virtual Memory Manager and came across a question about why a process's page table gets updated because of its access to a vmalloc()ed area. Here is a link to the diagram that he uses to…

Dayanidhi
- 41
- 7
3
votes
1 answer
create_module - why is copy_from_user used?
I'm reading LDD3. In chapter 8, I could not understand this paragraph:
An example of a function in the kernel that uses vmalloc is the create_module system
call, which uses vmalloc to get space for the module being created. Code and data of
the…

user1047069
- 935
- 2
- 13
- 25
3
votes
1 answer
How large VMALLOC space can be in 32bit x86?
My physical memory is 4G and I'm using Android x86 which is 32bit, HIGHMEM4G is enabled. I want to enlarge vmalloc() space as much as possible.
As I tried, if changing to 2G/2G VMsplit and making VMALLOC_RESERVED bigger, vmalloc() space can…

CindyRabbit
- 359
- 2
- 17
3
votes
1 answer
Does vmalloc() only get memory from ZONE_HIGHMEM on 32bit x86?
On 32bit x86 platform, if vmalloc() can allocate memory from either ZONE_NORMAL or ZONE_HIGHMEM, does it mean that even if I enlarge ZONE_HIGHMEM, the actual total range that vmalloc() can use is unchanged? I did a test to enlarge ZONE_HIGHMEM, the…

CindyRabbit
- 359
- 2
- 17
2
votes
1 answer
reading out large array from a linux kernel module
I've searched on this a good deal, though I definitely may have missed something, and I'm coming from reading the http://tldp.org/LDP/lkmpg/2.6/html/lkmpg.html and this…

gorgoth
- 123
- 1
- 8
1
vote
2 answers
Freeing (vfree-ing) pointer to volatile data
volatile seems to be a never ending question of every one. I thought I knew everything about it, but then I encountered this:
So, I have a piece of memory shared between threads and I defined it like this:
volatile type *name;
If it makes you feel…

Shahbaz
- 46,337
- 19
- 116
- 182
1
vote
0 answers
Vulkan Validation Layer error in vkQueuePresentKHR: Image layout is incorrect
I was working on this Vulkan tutorial and decided to implement a camera, which worked fine, then I decided to use Vulkan Memory Allocator. After I it, the project stopped working, giving me
validation layer: Validation Error: […
user21434270
1
vote
1 answer
vmalloc() allocates from vm_struct list
Kernel document https://www.kernel.org/doc/gorman/html/understand/understand010.html says, that for vmalloc-ing
It searches through a linear linked list of vm_structs and returns a new struct describing the allocated region.
Does that mean…

Franc
- 319
- 9
- 28