OOM KIller INVOKE

Hi
I have written a code that will exhaust the memory completely by allocating it and not freeing it. The OOM killer as expected in invoked and it killed a few high memory using processes and their childs.
But after that, though the system is not getting hung, it is not printing any msgs in console neither it is responding to ping or telnet.
What is the expected behaviour after an OOM kill. ? Please comment on why the node went into an virtual hung state after OOM kill.

---------- Post updated at 05:46 AM ---------- Previous update was at 05:42 AM ----------

This is the console prints:

available memory stated is 487MB
And malloc'd memory is 0MB
Enter percentage memory to be alloc'd (0 to quit) : 100
available memory stated is 487MB
And malloc'd memory is 487MB
malloc invoked oom-killer: gfp_mask=0x1200d2, order=0, oomkilladj=0
Call Trace:
[9e913d20] [80006844] show_stack+0x3c/0x1bc (unreliable)
[9e913d60] [80056a14] oom_kill_process+0x114/0x1bc
[9e913d90] [80056e60] out_of_memory+0x1ac/0x1e8
[9e913dd0] [800598f0] __alloc_pages_internal+0x40c/0x440
[9e913e50] [8006424c] handle_mm_fault+0x26c/0x470
[9e913e80] [801ccb58] do_page_fault+0x314/0x510
[9e913f40] [8000d834] handle_page_fault+0xc/0x80
Mem-info:
DMA per-cpu:
CPU 0: hi: 186, btch: 31 usd: 175
Active:123608 inactive:31 dirty:0 writeback:0 unstable:0
free:689 slab:1244 mapped:1259 pagetables:311 bounce:0
DMA free:2756kB min:2860kB low:3572kB high:4288kB active:494432kB inactive:124kB present:512064kB pages_scanned:772531 all_unreclaimable? yes
lowmem_reserve[]: 0 0 0
DMA: 14kB 08kB 016kB 032kB 164kB 1128kB 0256kB 1512kB 01024kB 12048kB 04096kB = 2756kB
1292 total pagecache pages
129024 pages of RAM
1730 reserved pages
7284 pages shared
0 pages swap cached
Out of memory: kill process 2021 (tn_init.d) score 162152 or a child
Killed process 2023 (nm.d)
malloc invoked oom-killer: gfp_mask=0x1200d2, order=0, oomkilladj=0
Call Trace:
[9e913d20] [80006844] show_stack+0x3c/0x1bc (unreliable)
[9e913d60] [80056a14] oom_kill_process+0x114/0x1bc
[9e913d90] [80056e60] out_of_memory+0x1ac/0x1e8
[9e913dd0] [800598f0] __alloc_pages_internal+0x40c/0x440
[9e913e50] [8006424c] handle_mm_fault+0x26c/0x470
[9e913e80] [801ccb58] do_page_fault+0x314/0x510
[9e913f40] [8000d834] handle_page_fault+0xc/0x80
Mem-info:
DMA per-cpu:
CPU 0: hi: 186, btch: 31 usd: 176
Active:123603 inactive:36 dirty:0 writeback:0 unstable:0
free:783 slab:1240 mapped:1259 pagetables:311 bounce:0
DMA free:3132kB min:2860kB low:3572kB high:4288kB active:494412kB inactive:144kB present:512064kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 0
DMA: 1
4kB 38kB 416kB 532kB 364kB 1128kB 0256kB 1512kB 01024kB 12048kB 04096kB = 3132kB
1292 total pagecache pages
129024 pages of RAM
1730 reserved pages
7284 pages shared
0 pages swap cached
Out of memory: kill process 2039 (nm.d) score 13684 or a child
Killed process 2039 (nm.d)

^C^C^C^C^C^C^C^Cc

================================================================
As seen its not responding to ^C . But on pressing enter , response is there.

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags

```text
 and 
```

by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

There is no expected behavour once time Oom Killer starts, it's a lottery. He could kill ANY process in order to free memory while is trying to keep the server up...

You could find more informacion in next link OOM Killer - linux-mm.org Wiki

I recommed you to setup netdump or diskdump and you could make a memory dump to analize after hung. Maybe you will discover a memory leak :wink:

Better yet, if you want to keep your server up don't oversubscribe resources in the first place.

         echo 2 > /proc/sys/vm/overcommit_memory