Basically the crew, guided by the manufacturer's figures for max alt v weight, typically based on a margin of 1.3g to allow for moderate manoeuvre or turbulence. Loads of other factors like sector length, speed and ATC, but these should answer your question.