Skip to contentSkip to conversation

Problem with OOM killer killing process even when there is plenty of RAM.

DISCUSSION mindentropy 5 participants 11 messages Dec 6, 2011 – Dec 9, 2011

lore
Share & tools
lore
#0 lore raw

Hi,

I am trying to allocate 512MB of RAM in my driver loaded as a module, but
the OOM killer starts killing all my processes. This machine has around 24GB RAM and is a 8 core Xeon. The RAM is allocated in page size chunks (i.e. 131072 chunks each of size PAGE_SIZE). I am using a 32 bit kernel with PAE enabled. The allocation works fine on a machine with 8GB of RAM.

Thanks.

#1 lore raw

driver allocating 512M !!?? what kind of driver it is?

-Rajat

Quoted 14 lines · mindentropy

Hi,

?I am trying to allocate 512MB of RAM in my driver loaded as a module, but the OOM killer starts killing all my processes. This machine has around 24GB RAM and is a 8 core Xeon. The RAM is allocated in page size chunks (i.e. 131072 chunks each of size PAGE_SIZE). I am using a 32 bit kernel with PAE enabled. The allocation works fine on a machine with 8GB of RAM.

Thanks.

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

#3 lore raw
In reply to mindentropy
Quoted 6 lines · mindentropy

Hi,

?I am trying to allocate 512MB of RAM in my driver loaded as a module, but the OOM killer starts killing all my processes. This machine has around 24GB RAM and is a 8 core Xeon. The RAM is allocated in page size chunks (i.e. 131072 chunks each of size PAGE_SIZE).

mind to tell us, how do you allocate memory? kmalloc?

furthermore, could you kindly paste the content of /proc/meminfo right before OOM kicks in?

Signature · 7 lines
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
#4 lore raw
Quoted 9 lines · Mulyadi Santosa
Quoted 6 lines · mindentropy

Hi,

I am trying to allocate 512MB of RAM in my driver loaded as a module,
but the OOM killer starts killing all my processes. This machine has around 24GB RAM and is a 8 core Xeon. The RAM is allocated in page size chunks (i.e. 131072 chunks each of size PAGE_SIZE).

mind to tell us, how do you allocate memory? kmalloc?

Via kmalloc.

Quoted 3 lines

furthermore, could you kindly paste the content of /proc/meminfo right before OOM kicks in?

Its kind of tough to do it as it happens so fast. I will try to write a script which polls.

#2 lore raw
In reply to Rajat Sharma
Quoted 4 lines · Rajat Sharma

driver allocating 512M !!?? what kind of driver it is?

-Rajat

For a high speed frame grabber. The data would be in bursts the queue is meant to smoothen the pressure. I am not sure why its surprising since I am using only 2% of the memory (Only 63MB is being used overall by the system).

#5 lore raw
In reply to mindentropy
Quoted 11 lines · mindentropy
Quoted 9 lines · Mulyadi Santosa
Quoted 6 lines · mindentropy

Hi,

I am trying to allocate 512MB of RAM in my driver loaded as a module,
but the OOM killer starts killing all my processes. This machine has around 24GB RAM and is a 8 core Xeon. The RAM is allocated in page size chunks (i.e. 131072 chunks each of size PAGE_SIZE).

mind to tell us, how do you allocate memory? kmalloc?

Via kmalloc.

Please use the functions written to give you large memory chunks. As you are using a video-for-linux device, why not use the apis that this framework provides you for this type of thing?

thanks,

greg k-h

#6 lore raw
Quoted 12 lines · Greg KH
Quoted 11 lines · mindentropy
Quoted 10 lines · Mulyadi Santosa
Quoted 8 lines · mindentropy

Hi,

I am trying to allocate 512MB of RAM in my driver loaded as a module,> > >
but the OOM killer starts killing all my processes. This machine has
around 24GB RAM and is a 8 core Xeon. The RAM is allocated in page size chunks (i.e. 131072 chunks each of size PAGE_SIZE).

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

mind to tell us, how do you allocate memory? kmalloc?

Via kmalloc.

Please use the functions written to give you large memory chunks. As you are using a video-for-linux device, why not use the apis that this framework provides you for this type of thing?

Yes V4L would be done next. There are some things being tried out, this being a custom FPGA hence some controls being experimented.

As for the allocating in PAGE_SIZE chunks why am I running out of memory? Can't it steal smaller chunks from the larger chunks? Just curious about the reason.

#7 lore raw
Quoted 22 lines · mindentropy
Quoted 12 lines · Greg KH
Quoted 11 lines · mindentropy
Quoted 10 lines · Mulyadi Santosa
Quoted 8 lines · mindentropy

Hi,

I am trying to allocate 512MB of RAM in my driver loaded as a module,> > >
but the OOM killer starts killing all my processes. This machine has
around 24GB RAM and is a 8 core Xeon. The RAM is allocated in page size chunks (i.e. 131072 chunks each of size PAGE_SIZE).

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

mind to tell us, how do you allocate memory? kmalloc?

Via kmalloc.

Please use the functions written to give you large memory chunks. As you are using a video-for-linux device, why not use the apis that this framework provides you for this type of thing?

Quoted 4 lines

Yes V4L would be done next. There are some things being tried out, this being a custom FPGA hence some controls being experimented.

As for the allocating in PAGE_SIZE chunks why am I running out of memory?

The kernel doesn't like allocating such large sizes all at once.

Quoted 2 lines

Can't it steal smaller chunks from the larger chunks? Just curious about the reason.

Use vmalloc if you need/want larger chunks, kmalloc is not for that at all.

greg k-h

#8 lore raw
Quoted 36 lines · Greg KH
Quoted 22 lines · mindentropy
Quoted 12 lines · Greg KH
Quoted 11 lines · mindentropy
Quoted 10 lines · Mulyadi Santosa
Quoted 8 lines · mindentropy

Hi,

?I am trying to allocate 512MB of RAM in my driver loaded as a ?module,> > >
but the OOM killer starts killing all my processes. This machine has
around 24GB RAM and is a 8 core Xeon. The RAM is allocated in page size chunks (i.e. 131072 chunks each of size PAGE_SIZE).

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

mind to tell us, how do you allocate memory? kmalloc?

Via kmalloc.

Please use the functions written to give you large memory chunks. ?As you are using a video-for-linux device, why not use the apis that this framework provides you for this type of thing?

Quoted 4 lines

Yes V4L would be done next. There are some things being tried out, this being a custom FPGA hence some controls being experimented.

As for the allocating in PAGE_SIZE chunks why am I running out of memory?

The kernel doesn't like allocating such large sizes all at once.

Quoted 2 lines

Can't it steal smaller chunks from the larger chunks? Just curious about the reason.

Use vmalloc if you need/want larger chunks, kmalloc is not for that at all.

Quoted 6 lines

greg k-h

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

Probably if it is some custom hardware, and you can afford to allocate memory at boot time, then reserve it exclusively for your use only.

-Rajat

#9 lore raw
In reply to mindentropy

Hi...

Quoted 2 lines · mindentropy
Quoted 1 line

mind to tell us, how do you allocate memory? kmalloc?

Via kmalloc.

As Greg said, you probably better use vmalloc for such allocation. Vmalloc can deal with non contigous physical pages...

Quoted 5 lines
Quoted 3 lines

furthermore, could you kindly paste the content of /proc/meminfo right before OOM kicks in?

Its kind of tough to do it as it happens so fast. I will try to write a script which polls.

Alright, I just thought it will be better if we understand the overall virtual memory situation better.

Signature · 7 lines
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
#10 lore raw

Hi,
use of
get_zeroed_page(unsigned int flags); or
get_free_page(unsigned int flags);
might help you.

Thanks,
Pritam

Quoted 34 lines · Mulyadi Santosa

Hi...

Quoted 2 lines · mindentropy
Quoted 1 line

mind to tell us, how do you allocate memory? kmalloc?

Via kmalloc.

As Greg said, you probably better use vmalloc for such allocation. Vmalloc can deal with non contigous physical pages...

Quoted 4 lines
Quoted 3 lines

furthermore, could you kindly paste the content of /proc/meminfo right before OOM kicks in?

Its kind of tough to do it as it happens so fast. I will try to write a

script

Quoted 1 line

which polls.

Alright, I just thought it will be better if we understand the overall virtual memory situation better.

--
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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

Signature · 4 lines
Pritam Bankar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20111209/1ddbc396/attachment.html