Measuring almost-critical values of smooth functions. 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$?
 A: It true that the function $M_f: \epsilon\mapsto
\operatorname{meas} f\{\|\nabla f(x)\| < \epsilon\}$ is left-continuous   (that is, since it is in any case an increasing function, lower semi-continuous); in particular continuous at $\epsilon=0$.
Indeed, if $\epsilon_n\ge0$ is an increasing  sequence converging to $\epsilon\ge0$ one has 
$$ f\{\|\nabla f(x)\| < \epsilon\}=\bigcup_{n\in\mathbb{N}} f\{\|\nabla f(x)\| < \epsilon _ n\}\, ,$$
so $ \operatorname{meas} f\{\|\nabla f(x)\| < \epsilon _ n\}\to \operatorname{meas} f\{\|\nabla f(x)\| < \epsilon \} $. However it is not right-continuous in general. Think of the case $X:=\mathbb{S}^1=\mathbb{R}/\mathbb{Z}$, with a 1-periodic function $f:\mathbb{R}\to\mathbb{R}$ with a minimum value $f(0)=0$, and a maximum value $f(1/2)$, and such that $|f'(x)|=1$ everywhere but in a nbd $U$ of small measure $\delta < f(1/2)/2$ of the maximum and minimum points, where $|f'(x)|<1$. In this situation, $f\{| f'(x)| < 1\}=f(U)$ has measure at most $2\delta$, whereas $f\{| f'(x)| \le 1\}=f([0,1])=f(1/2) .$ Therefore $M_f$ can't be continuous at $\epsilon=1$.
