Lagrangian Formulation of the linear autonomous magnetization dynamics in spin-torque oscillators