Codimension one foliation

let $f:M \rightarrow \mathbb{R}$ be a nowhere vanishing function defined on a Riemannian manifold $(M,g)$. consider the distribution $\ker(df)$. This is clearly involutive and thus defines a foliation. My question is now: is it possible that the dimension of the foliation changes or it remains $n-1$, where $n = \dim(M)$? Well this should depend on the function, right? What conditions, on $f$, does one need to impose in order that the foliation remains codimension one?

bill

-
The dimension can certainly change. Consider $f$ Morse at a critical point - e.g. $f:\mathbb{S}^2\ni (x,y,z)\to z\in\mathbb{R}$. But by Sard, almost everywhere the foliation is codimension $1$. – Neal Dec 12 '12 at 13:37
I can't see why you want $f$ to be nowhere vanishing. Do you mean instead that $f$ is such that $\mathrm{d}f$ is nowhere vanishing? In addition, I also don't see why you want a Riemannian manifold. Nowhere is the metric $g$ necessary for this question. – Willie Wong Dec 12 '12 at 13:52
Adding on to what Neal said, if $M$ is compact (and more than one point), $df$ must vanish at least twice - at the max and min of $f$. Further, for example, if $M = S^{2n}$, $M$ doesn't have any codimension one foliations at all. – Jason DeVito Dec 12 '12 at 14:10