Re: 2.4.18(19) swapcache oops

Date: Fri Aug 16 2002 - 03:07:52 EST

From: Andrew Morton <>
Subject: Re: 2.4.18(19) swapcache oops
Date: Thu, 15 Aug 2002 21:40:26 -0700

> You must have been able to reproduce it quite quickly. But the
> code has been like that for ages. Why is that? Are you testing
> on an unusual machine?

Not so unusual. It's Itanium2 SMP machine (4cpus to 32cpus).
The problem have occured at first after I run a very large multi-threaded
program for days.

To investigate the problem, I made a small program which allocate
memory and then create some threads to access the shared space in parallel.
It makes shared pages swapped in and out with very high frequency.
Running it with small free memory situation, the program could cause
the oops in a few minutes on 4cpu machine.

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

#define NPROC 4
#define SIZE 0x20000000

char *ptr;

loop(void* none)
                memset((char *)ptr, 0, SIZE);
main(int argc, char** argv)
        int i;
        void *v;

        pthread_t tid[NPROC];

        memset(ptr, 0, SIZE);

        for(i=0; i<NPROC; i++){
                pthread_create((pthread_t *)&tid[i],
                                (pthread_attr_t *)NULL,
                                (void *)NULL);

        for(i=0; i<NPROC; i++)
                pthread_join(tid[i], (void**)NULL);

        return 0;

> > As to the second fix from 2.5.32, it can't be applicable to 2.4, can it?
> > try_to_swap_out() may call add_to_swap_cache() with PG_lru page.
> Ah, good point. In 2.5, add_to_page_cache() does not add the
> page to the LRU. Anonymous pages are already there, and we
> don't need to do that. The first patch should be OK.

I hope the patch will be taken in next 2.4 release.

Best regards.

NOMURA, Jun'ichi <,>
HPC Operating System Group, 1st Computers Software Division,
Computers Software Operations Unit, NEC Solutions.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Fri Aug 23 2002 - 22:00:11 EST