Re: 2.4.18(19) swapcache oops

j-nomura@ce.jp.nec.com
Fri, 16 Aug 2002 17:07:52 +0900 (JST)


From: Andrew Morton <akpm@zip.com.au>
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;

void*
loop(void* none)
{
while(1)
memset((char *)ptr, 0, SIZE);
}

int
main(int argc, char** argv)
{
int i;
void *v;

pthread_t tid[NPROC];

ptr=malloc(SIZE);
memset(ptr, 0, SIZE);

for(i=0; i<NPROC; i++){
pthread_create((pthread_t *)&tid[i],
(pthread_attr_t *)NULL,
loop,
(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 <j-nomura@ce.jp.nec.com, nomura@hpc.bs1.fc.nec.co.jp>
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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/