Re: why does mlockall appear to make memcpy slower ?

From: David Schleef (ds@stm.lbl.gov)
Date: Mon Apr 03 2000 - 13:43:39 EST


On Mon, Apr 03, 2000 at 02:00:27PM -0400, Richard B. Johnson wrote:
> On Mon, 3 Apr 2000, Paul Barton-Davis wrote:
>
> > >> The following program prints:
> > >>
> > >> Average msecs per MB 4.914158; Average copy rate: 0.000005 msecs/byte
> > >>
> > >> if run without root permission (i.e. mlockall() fails), and
> > >>
> > >> Average msecs per MB 7.417227; Average copy rate: 0.000007 msecs/byte
> > >>
> > >> if run with root permission.
> > >>
> > >> Is there a simple explanation ?
> > >
> > >mlockall() is a privileged call. Performance could improve if all pages
> > >are locked. The non-root version doesn't perform as well because
> > >mlockall() fails, subjecting the pages to the system's evil memory
> > >management schemes (paging/etc).
> > >
> > >I'm almost positive you know this though, so your question seems strange.
> >
> > Look at what I wrote again. It runs *slower* when run as root, and
> > faster when not. That is, mlockall() causes it run slower.
> >
> > --p
>
> Not here. If I just comment out your mlockall() it runs at the
> same apparent speed one way or the other. FYI, I don't understand
> how you are calculating speed, but that's another question altogether.
>

It looks like a curiousity, if not an actual bug. Wouldn't expect an mlockall'd
processes to accrue so many more page faults:

[root@stm tmp]# time ./it
Average msecs per MB 8.049710; Average copy rate: 0.000008 msecs/byte
Command exited with non-zero status 70
1.81user 0.02system 0:01.85elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (261major+522minor)pagefaults 0swaps
[root@stm tmp]# exit
exit
stm:~/tmp$ time ./it
Average msecs per MB 5.298867; Average copy rate: 0.000005 msecs/byte
Command exited with non-zero status 70
1.19user 0.01system 0:01.21elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (88major+266minor)pagefaults 0swaps
stm:~/tmp$

dave...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Apr 07 2000 - 21:00:10 EST