We consider linear optimization over a nonempty convex semialgebraic feasible region F . Semidefinite programming is an example. If F is compact, then for almost every linear objective there is a unique optimal solution, lying on a unique "active" manifold, around which F is "partly smooth", and the second-order sufficient conditions hold. Perturbing the objective results in smooth variation of the optimal solution. The active manifold consists, locally, of these perturbed optimal solutions; it is independent of the representation of F , and is eventually identified by a variety of iterative algorithms such as proximal and projected gradient schemes. These results extend to unbounded sets F .