When is the integral of a square less than the square of the integral? I know Cauchy-Schwarz tells us 
$$
\left(\int_a^b f(x)\, dx\right)^2 \leq (b-a)\int_a^b f^2(x)\, dx
$$
is true for all functions $f \in L^1(a,b)\cap L^2(a,b)$ where $a,b \in \mathbb R$.  I was just wondering if there was a general case for which the "opposite" inequality holds, i.e. when is
$$
\int_a^b f^2(x)\, dx \leq C\left(\int_a^b f(x)\, dx\right)^2
$$
true for some value $C$?  I know it holds for at least a few elementary functions (e.g. $f(x) = |x|$, $a = -\pi$, $b=\pi$, and $C=1$), and I know $f(x)$ needs to be positive (otherwise you could pick an odd (non-zero) function on a symmetric interval and contradict it immediately).  Any insight would be greatly appreciated.

The constant $C$ does not exist, even if you require that the function $f$ be bounded from above by a constant $M>0$.  To see this, let $N$ be a positive integer such that $\dfrac1N< b-a$.  For each integer $n\geq N$, define 
$$f_n(x):=\left\{\begin{array}{ll}
M&\text{for }x\in\left(a,a+\frac{1}{n}\right]\,,\\
0&\text{for }x\in\left(a+\frac{1}{n},b\right)\,.
\end{array}\right.$$
Then, $$\int_a^b\,\left(f_n(x)\right)^2\,\text{d}x=\frac{M^2}{n}\text{ and }\int_a^b\,f_n(x)\,\text{d}x=\frac{M}{n}\,.$$
Therefore, $C$ cannot exist; otherwise, you will have $$C\geq n\text{ for every integer }n\geq N\,.$$ 

It is also not sufficient that $f$ is only bounded from below by a constant $m\geq 0$.  To see this, let $N\geq m$ be a positive integer such that $\dfrac1N< b-a$.  For each integer $n\geq N$, define 
$$f_n(x):=\left\{\begin{array}{ll}
n&\text{for }x\in\left(a,a+\frac{1}{n}\right]\,,\\
m&\text{for }x\in\left(a+\frac{1}{n},b\right)\,.
\end{array}\right.$$
Then, $$\int_a^b\,\left(f_n(x)\right)^2\,\text{d}x=n+m^2\,\left(b-a-\frac{1}{n}\right)\text{ and }\int_a^b\,f_n(x)\,\text{d}x=1+m\left(b-a-\frac{1}{n}\right)\,.$$
Therefore, $C$ cannot exist; otherwise, you will have $$C\geq \frac{n+m^2\,\left(b-a-\frac{1}{n}\right)}{1+m\,\left(b-a-\frac{1}{n}\right)}\text{ for every integer }n\geq N\,.$$ 

On the other hand, if $f$ is bounded from below by a constant $m>0$ as well as being bounded from above by $M>0$, then you can say something.  Note that
$$\int_a^b\,f(x)\,\text{d}x\geq m(b-a)\,.$$
Therefore,
$$\left(\int_a^b\,f(x)\,\text{d}x\right)^2\geq m(b-a)\,\int_a^b\,f(x)\,\text{d}x=\frac{m(b-a)}{M}\,\int_a^b\,M\,f(x)\,\text{d}x\,.$$
As $f\leq M$, we have
$$\left(\int_a^b\,f(x)\,\text{d}x\right)^2\geq \frac{m(b-a)}{M}\,\int_a^b\,\big(f(x)\big)^2\,\text{d}x\,.$$
That is, $$C:=\frac{1}{b-a}\,\left(\frac{M}{m}\right)$$
suffices.
We can actually do better by finding the smallest possible value of $C$.  First, note that
$$\big(M-f(x)\big)\,\big(f(x)-m\big)\geq 0\text{ for all }x\in[a,b]\,.$$
Therefore,
$$\big(f(x)\big)^2\leq (M+m)\,f(x)-Mm\,.\tag{*}$$
Thus,
$$\int_a^b\,\big(f(x)\big)^2\,\text{d}x\leq (M+m)\,\int_a^b\,f(x)\,\text{d}x-Mm(b-a)\,.$$
We shall show that $$C:=\frac{1}{b-a}\,\left(\frac{(M+m)^2}{4Mm}\right)$$ suffices.  Note that
$$\small C\,\left(\int_a^b\,f(x)\,\text{d}x\right)^2-(M+m)\,\int_a^b\,f(x)\,\text{d}x+Mm(b-a)=C\,\left(\int_a^b\,f(x)\,\text{d}x-\left(\frac{2Mm}{M+m}\right)\,(b-a)\right)^2\geq0\,.$$
Thus, from (*), we indeed have
$$\int_a^b\,\big(f(x)\big)^2\,\text{d}x\leq \frac{1}{b-a}\,\left(\frac{(M+m)^2}{4Mm}\right)\,\left(\int_a^b\,f(x)\,\text{d}x\right)^2\,.$$
The equality holds if and only if there exist two disjoint subsets $A$ and $B$ of $[a,b]$ such that $A$ has Lebesgue measure $\dfrac{m}{M+m}\,(b-a)$, $B$ has Lebesgue measure $\dfrac{M}{M+m}\,(b-a)$, and $$f=M\,\chi_A+m\,\chi_B$$ almost everywhere.  Here, $\chi_S$ is the indicator function of a set $S$.  Since the inequality above is sharp, $C=\dfrac{1}{b-a}\,\left(\dfrac{(M+m)^2}{4Mm}\right)$ is indeed the smallest possible value.
