Re: 2.1.97 mm and cache - basic stupid idea included!

Benjamin Redelings I (bredelin@UCSD.Edu)
Mon, 20 Apr 1998 20:54:45 -0700


Rik, thanks for your reply and the Documentation that you mentioned :)
The SC_ROUNDROBIN thing does sound interesting. Um, actually I have an
idea for a fix, besides a clearer description of the problem. Could you
comment on why it would/wouldn't work slightly? Maybe its too
complicated in practice?

Neither /proc/sys/vm nor SC_ROUNDROUBIN can fix the problem that I'm
talking about, I think. I'm thinking about what will happen if you have
say 20Mb of your 64Mb Physical RAM taken up in cache and the other 44 Mb
taken up by Netscape, XFree86, emacs and other programs. Then you
attempt to load some large program like (say) quake, which want (say)
10Mb.
The question here is not really about the swapping section of VM, but
about the cache section, right? The question is "How much of the cache
space is the cache manager going to give up?". There should probably be
a minimum percentage of RAM that is used up by the cache, but the
maximum SHOULD be near 75% of 64Mb and so will not make any difference
here. There must be some other principle (that BTW is not in
/proc/sys/vm now, I think) which decides how much of the cache to give
up. I suppose you could run some daemon which continuously adjusted the
values on /proc/sys/vm according to the system weather...but which
strategy to use?
Whatever strategy you use SHOULD take into account how much stuff
kswapd would be forced to swap if the strategy kept back x Mb of RAM for
cache. This strategy seems like it will have to be complicated to
work... but I think it would be worth it. It will have to handle 2 easy
questions, and 1 hard one:

(easy: what I get mad at the machine for not doing ;)
Q1. If there is not "pressure" for memory, should I let the cache grow
as large as possible?
A1. Yes, Duh! e.g., If netscape is the only program (besides XFree)
running, let the cache get HUGE!

Q2. When other programs start running, should I decrease the cache size,
or swap?
A2. Decrease the cache size!!!!

(hard)
Q3. Eventually, we should stop decreasing the cache size, and swap a
little.
When?

A3.1 Default (not very good): at some specified "minimum percentage"
A3.2 Above the "minimum percentage" and depend on the system "weather"
and other conditions, like various other subsystems. Estimate how the
improvement of each system ("filesystems" and "memory") would change if
you gave it 4kb.
filesystems: performance improves if info is already in memory (cache)
(virtual) memory: performance improves if info is already in memory
(e.g. NOT SWAPPED!)

(Note: "pressure" is a good analogy. If you want to minimize the
"energy" of the system, then the "pressure" should be like "dE/dx". In
my example, dx=4k. Coming up with some common measure of E could be
hard... but I would just suggest the total number of disk reads
predicted by the page-aging statistics.... if that would work.)

That was fun :)
Any content?

Thanks,
-BenRI

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu