Questions tagged [kmalloc]

The kmalloc function performs fast dynamic memory allocation and is part of the Linux Kernel API.

The kmalloc() function performs dynamic memory allocation and is part of the Linux Kernel API. In contrast to malloc, this function allocates memory faster in regions of contiguous physical memory, and it doesn't clear the memory it obtains.

More information can be found here

51 questions
0
votes
1 answer

Passing a list of values to kernel space

I'm working on a linux project. I need to pass a list of integer values to the kernel from a userspace program. I implemented a system call for this. In the userspace program, I had the following code. The value of num_values is obtained from…
ch2301
  • 3
  • 1
0
votes
1 answer

kmallc and vmalloc return logical address?

Although there are many threads already running on kmalloc and vmalloc but I did not get my exact answer so I am putting it here. As far I know, kmalloc : It is kernel API which allocates physically as well virtually contiguous memory. vmalloc : It…
0
votes
1 answer

Using kmalloc in a device driver

In an assignment I have I have to create a device driver for a deck of cards. However I am having trouble using kmalloc on an array of structs. The array of structs the deck and of size 52. I have the following so far (obviously it's…
user3268401
  • 319
  • 1
  • 7
  • 21
0
votes
0 answers

Kmalloc in dentry_open(): kernel panic

I'm working on kernel linux 2.6.34.14. I added (in include/linux/fs.h) in struct file a pointer to a struct defined before, in this way: struct session{ char *session_buffer; loff_t session_dimension; }; struct file { struct session…
0
votes
1 answer

Understanding the use of memset in this example

I'm studying an example from the Linux Device Driver book(http://lwn.net/Kernel/LDD3/), and I don't understand the use and usefullness of the function memset in this context and I hoped that someone could explain it to me. I understand that we…
John
  • 317
  • 4
  • 19
0
votes
1 answer

How can kmalloc return a physical address greater than the size of the physical address?

I am allocating a block of memory with kmalloc in a device driver in Linux. The address that I get is 0xffff880000180000. I am using an IvyBridge processor with a 46-bit physical address space. That means that the CPU doesn't have more than 46…
Nathan Fellman
  • 122,701
  • 101
  • 260
  • 319
1 2 3
4