I've got a virtual server and my provider charges me on per-resource-usage basis. I can set a limit on maximum RAM, but I'm still charged for actually used RAM, not the maximum (the price is calculated every 5 minutes based on actual usage).
Using all RAM would be okay normally, but Linux policy "unused RAM is wasted RAM" falls short for this kind of accounting, since the machine will eventually end up using all available RAM, and even though most of it as a disk cache only, I still have to pay for it.
I like to set the limit at provider a bit higher to accommodate peak needs for RAM. Can I, somehow, limit how much memory is going to be used for caching etc? Let's say I reserve 3 GB and my application + system services normally needs 1GB, but if there is a real need, my application can use 2GB of RAM extra, but when idling I want to limit the cache to take e.g. only up to 500 MB of free RAM, so that I don't have to pay for 3 GB all the time.