Hi Steve. Pls find attached code for stress application. The test code is very simple. Just alloc memory. we got this issue on embedded Target. After analysis we found that most of task(stress_application) is in D for uninterruptible sleep. application state stress x stress D stress x stress D stress x stress D stress x sleep D Thanks On Thu, Aug 25, 2011 at 7:27 PM, Steve Chen <schen@xxxxxxxxxx> wrote: > On Thu, Aug 25, 2011 at 1:06 AM, naveen yadav <yad.naveen@xxxxxxxxx> wrote: >> I am paste only small crash log due to size problem. >> >> >> >> >>> Hi All, >>> >>> We are running one malloc testprogram using below script. >>> >>> while true >>> do >>> ./stress & >>> sleep 1 >>> done >>> >>> >>> >>> >>> After 10-15 min we observe following crash in kernel >>> >>> >>> Kernel panic - not syncing: Out of memory and no killable processes... >>> >>> attaching log also. >>> >>> Thanks >>> >> >> _______________________________________________ >> linux-arm-kernel mailing list >> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >> >> > > Can you share the code in ./stress? > > Thanks, > > Steve >
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #include <unistd.h> #define ALLOC_BYTE 512*1024 #define COUNT 500 void *alloc_function( void *ptr ); int main(int argc, char *argv[]) { pthread_t thread1, thread2; char *message1 = "Thread 1"; int iret1, iret2; iret1 = pthread_create( &thread1, NULL, alloc_function, (void*) message1); pthread_join( thread1, NULL); printf("Thread 1 returns: %d\n",iret1); exit(0); } void *alloc_function( void *ptr ) { char *message; message = (char *) ptr; void *myblock[COUNT]; int i= 0,j=0; int freed=0; printf("message_alloc \n"); while(1) { memset(myblock,0,sizeof(myblock)); printf("message_alloc %s \n",message); for(i=0;i< COUNT ;i++) { myblock[i] = (void *) malloc(ALLOC_BYTE); if (!myblock[i]) { printf("No memory for allocating: freeing \n"); printf("OOM may kill ME \n"); for(j=0;j < i;j++) { freed = 1; free(myblock[j]); printf("Currently freeing %d * %d Bytes \n",j,ALLOC_BYTE); } break; } memset(myblock[i],1, ALLOC_BYTE); // printf("Currently allocating %d * %d Bytes \n",i,ALLOC_BYTE); } sleep(1); #if 1 if(!freed) { for(i=0;i< COUNT;i++) { free(myblock[i]); // printf("Currently freeing %d * %d Bytes \n",i,ALLOC_BYTE); } } sleep(1); #endif } }