Eugene Teo <eugene.teo@eugeneteo.net> writes: > <quote sender="Ed L Cashin"> >> Hi. I can choose one of two different related things in userland, and >> one takes more physical memory than the other but runs faster. > > you mean one memory intensive, one io intensive? Nope. :) Strategy "A" uses more page tables (pinned in RAM) and runs fast, while strategy "B" uses fewer page tables and runs somewhat slower. >> Looking at the number of free pages in the system doesn't really tell >> me whether memory is "tight" or not. There could be plenty of pages >> being used for caches, and at the first sign of memory pressure, those >> caches may shrink. >> >> The best way I can think of to know whether memory is really tight is >> to measure how often shrink_zone is getting called. (I'm looking at a >> 2.6.0-test11 kernel.) >> >> I can add some light instrumentation to track the rate at which >> shrink_zone gets called and a system call to make that rate visible to >> userland. Is there an existing way already in place or a better way >> to know when memory is tight? > > cat /proc/vmstat, see pgscan. but the stat is commulative. At a glance, that looks like just the thing, with stuff like "pgsteal" and "pgscan". Thanks! I will look into it. I'm interested in system-wide memory pressure, so that's OK. I can sample periodically and observe the rates over time. -- --Ed L Cashin | PGP public key: ecashin@uga.edu | http://noserose.net/e/pgp/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/