Re: missing madvise functionality

Andrew Morton
2007-04-03T23:02:53Z

On Tue, 3 Apr 2007 14:49:48 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:

> > int
> > main (void)
> > {
> > pthread_t th[32];
> > int i;
> > for (i = 0; i < 32; i++)
> > if (pthread_create (&th[i], NULL, tf, NULL))
> > exit (4);
> > for (i = 0; i < 32; i++)
> > pthread_join (th[i], NULL);
> > return 0;
> > }
> >
>
> whee. 135,000 context switches/sec on a slow 2-way. mmap_sem, most
> likely. That is ungood.
>
> Did anyone monitor the context switch rate with the mysql test?
>
> Interestingly, your test app (with s/100000/1000) runs to completion in 13
> seocnd on the slow 2-way. On a fast 8-way, it took 52 seconds and
> sustained 40,000 context switches/sec. That's a bit unexpected.
>
> Both machines show ~8% idle time, too :(

All of which indicates that if we can remove the down_write(mmap_sem) from
this glibc operation, things should get a lot better - there will be no
additional context switches at all.

And we can surely do that if all we're doing is looking up pageframes,
putting pages into fake-swapcache and moving them around on the page LRUs.

Hugh? Sanity check?

That difference between the 2-way and the 8-way sure is odd.