LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 10-27-2009, 08:25 PM   #1
yaplej
Member
 
Registered: Apr 2009
Distribution: CentOS, Ubuntu, openSuSE
Posts: 165
Blog Entries: 1

Rep: Reputation: 22
Problems allocating memory in kernel module


Hello all,

I am trying to allocate a new block of memory for an array using vmalloc_user(), but it only works when I allocate memory in the module initialization function.

Durring module initialization I register a funcion using dev_add_pack(), and that function tried to allocate some memory using vmalloc_user(), but it causes the system to crash.

I have done some additinal testing, and found that kcalloc() works fine outside of the module initialization function. I am going to need more memory that kcalloc() or kmalloc() can assign. I belive the limit is 128KB. So is there any reason why vmalloc_user() would not work after module initialization?

Thanks.
 
Old 10-27-2009, 11:11 PM   #2
yaplej
Member
 
Registered: Apr 2009
Distribution: CentOS, Ubuntu, openSuSE
Posts: 165

Original Poster
Blog Entries: 1

Rep: Reputation: 22
I might have found the answer to why vmalloc() fails after module initialization.
http://forum.soft32.com/linux2/kmall...pict16337.html

Acording to that post vmalloc() can sleep, and thats fine in the module initialization function(process context), but not in a function executed by dev_add_pack() (interupt context) because it can sleep. That would explain why vmalloc worked in init, but caused the crash later.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Kernel Module Allocating memory? yaplej Linux - Kernel 4 10-01-2009 06:19 PM
Allocating Memory in the kernel arunachalam Linux - Software 4 10-12-2005 08:51 AM
Allocating memory for user program variable from kernel module appas Programming 2 08-12-2004 10:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 08:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration