I'd say the rightest thing to do is compute - either mechanically or
by hand - what amount of physical memory would put SLR as close as
possible to 200000 without going over, then cap physical memory size
at that value (preferably with a message).
Yep, but that is not possible, since ~everything is possible to
change dynamically and we cannot expand the SPT on-demand since it is
located in physical memory.
I guess I didn't pick a good wording. I wasn't talking about anything
that would mean fiddling the SPT at runtime. I was talking about
something like
/* With more than 497M of physical memory, SLR exceeds 20000. */
#define MAXPHYSMEM (497 << 20)
(or whatever the actual value is), and then, at some appropriate point,
if (avail_end > MAXPHYSMEM) avail_end = MAXPHYSMEM;
To get fancy, instead of a #define, do a little run-time arithmetic,
possibly involving the kernel size and maybe other things (attached
buses, perhaps?).