flush xorg image cache?

Alan Coopersmith Alan.Coopersmith at Sun.COM
Sun Apr 24 20:43:36 PDT 2005


Roland Mainz wrote:
> That's for Linux/glibc but not for all the other OSes. Additionally only
> relatively long-living memory such as pixmaps should be allocated using
> |mmap()| as this always results in a syscall (AFAIK Jim Gettys said some
> while ago that the Xserver code is a good exercise in avoiding
> syscalls... :) and may require some additional adjustments (for example
> I'd like to force the usage of large pages (64K, 512K, 4M) for pixmap
> memory to save some entries in the TLB).

As you know, we do this in Xsun on Solaris, only for pixmaps, and only for
pixmaps larger than 1MB (which isn't many).   It was originally done with
a 8k threshold in the early SPARC days, when a fully loaded workstation
maxed out at 32MB, and helped on various benchmarks then.   Now, when we
have 100 X servers on a server machine with 16GB RAM, we found having the
threshold that low resulted in so many additional mappings (hundreds for a
typical GNOME desktop) that it was thrashing the TLB's, and not resulting
in enough of a memory savings to be measurable, hence the raise to a 1MB
threshold.  Even so the syscall use has been noticed, such as when the
dtrace gurus were trying to figure out why Xsun was constantly mapping and
unmapping pages, and found it was a broken app constantly creating and 
freeing identical pixmaps instead of just reusing the one it had. [1]
We've wondered with the performance guys if this is a hack that's outlived
it's useful life, but not had time to do much testing there to find out.

(Also, remember mmap()'ing something ensures it's rounded to the nearest
page boundaries where before it could have shared space on the page, so
you may end up using more memory, and if all your pixmaps are page aligned,
that could have an effect on your CPU cache utilization, depending on what
sort of cache filling algorithm your CPU uses.)

[1] For the full story, see Section 9 of 
http://www.sun.com/bigadmin/content/dtrace/dtrace_usenix.pdf

-- 
	-Alan Coopersmith-           alan.coopersmith at sun.com
	 Sun Microsystems, Inc. - X Window System Engineering





More information about the xorg mailing list