[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug 1594 (linux mm)] New - mm bug



http://distro.conectiva.com.br/bugzilla/show_bug.cgi?id=1594

           Summary: mm bug
           Product: Linux kernel MM
           Version: 2.4 (stable)
          Platform: All
               URL:
        OS/Version: Linux
            Status: UNCONFIRMED
 Status Whiteboard:
          Keywords:
        Resolution:
          Severity: blocker
          Priority: P3
         Component: linux mm
        AssignedTo: linux-mm-bugs@nl.linux.org
        ReportedBy: xose@smi-ps.com


try petalo.c and petalo_t like a normal user on kernel-2.4.1
plus patch-2.4.1-ac20

---petalo.c---

#include <stdio.h>
#include <stdlib.h>

main()
{
        void *buf[2048];
        long int mem = 0x3000000;
        int i = 0;

        for(;;)
        {
                printf("%lX\n", mem);
                buf[i] = malloc(mem);
                if (buf[i] == NULL) 
                    mem /= 2;
                else 
                {
                    memset(buf[i], i, mem);
                    i++;
                }
                if(mem < 1)
                {
                    sleep(1);
                    mem = 0x20000;
                }
        }
        getchar();
}
---end---

--petalo_t.c---
/* 
 * compile with gcc -o petalo petalo.c -lpthread
 */

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>


#define MAXT 4096

void petalo(void *n);

main()
{
    int i;
    pthread_t th_num[MAXT];
    void *retval;

    for(;;)
    {
        for(i = 0; i < MAXT; i++)
                pthread_create(&th_num[i], NULL,(void*)&petalo,(void*)i);
        for(i = 0; i < MAXT; i++)
                pthread_join(th_num[i], &retval);
    }
    return 0;
}

void petalo(void *n)
{
        void *buf[2048];
        long int mem = 0x3000000 >> ((int)n);
        int i = 0;

        for(;;)
        {
                buf[i] = malloc(mem);
                if (buf[i] == NULL) 
                    mem /= 2;
                else 
                {
                    memset(buf[i], i, mem);
                    i++;
                }
                if(mem < 1)
                {
                    usleep(5000);
                    mem = 0x20000;
                }
        }
}
---end---


linux-mm with petalo.c is ok, you can more than one time. But 
if you run petalo_t more than one time the system hang.

thanks
-
Linux-mm-bugs:  bugzilla list for the Linux-MM subsystem
Archive:        http://mail.nl.linux.org/linux-mm-bugs/
Web site:       http://www.linux.eu.org/Linux-MM/
Development:    linux-mm@kvack.org