Consider a compact sub-manifold $X \subset \mathbb{R}^n$ of Euclidean space and let $f:X \to \mathbb{R}$ be any smooth function. Recall that $x \in X$ is a critical point of $f$ if the gradient $\nabla_x f$ is identically zero, and in this case $f(x) \in \mathbb{R}$ is called a critical value of $f$. It is well-known by Sard's theorem that the set of critical values of $f$ has Lebesgue measure zero as a subset of $\mathbb{R}$.
Is there a "fuzzy" version of this theorem for a suitable class of smooth functions?
More precisely, define the monotone function $M_f : \mathbb{R}^+ \to \mathbb{R}^+$ as follows: $M_f(\epsilon)$ is the Lebesgue measure of the set $$\lbrace p \in \mathbb{R} \mid p = f(x) \text{ for some } x \in X \text{ with }\|\nabla_x f \| < \epsilon\rbrace.$$ By Sard's theorem, $M_f(0) = 0$ for any smooth $f$.
Here's the question:
Can we classify those smooth $f:X \to \mathbb{R}$ for which $M_f$ is continuous on its domain of definition in general (and in particular, continuous from above at $0$)?
Essentially, we know that the measure of values of $f$ where the gradient of the pre-image equals zero is zero. When the gradient comes within $\epsilon$ of zero, can we bound the measure by a continuous function of $\epsilon$?