On 06/11/2012 04:47 AM, Voelker, Bernhard wrote: > shouldn't the * 0.75 be _instead_ of the /2 then?
In some sense it is "instead" already. The /2 is for hard limits, i.e., the program will crash if you exceed them. The 0.75 is for a soft limit, i.e., the program will run (though perhaps slowly) if you exceed it. The idea is to be more-conservative about hard limits than about soft ones. > and I'd put it before the rlimit calculation: > e.g. a system has 8GB of RAM, but the admin want sort to > only take 4GB. He'll use ulimit or plimit to 4GB. > With this patch, sort will only take 3GB. > Am I wrong? I think so. The newly inserted code "if (total * 0.75 < size) size = total * 0.75;" is independent of the limits affected by the ulimit and plimit commands. In your example 'sort' will consume 4 * 15/16 GB if physmem_available reports 4 GB available.
