Solution (source code)

= Solution

Put $u=\varepsilon v+O(\varepsilon^2)$. The <linearization> at the zero solution is
$$
v_t=Dv_{xx}+f'(0)v,\qquad v(0,t)=v(L,t)=0.
$$
The appropriate <Fourier sine series> is
$$
v(x,t)=\sum_{n\ge1}a_n(t)\sin(n\pi x/L),\qquad
a_n(0)=\frac2L\int_0^Lu_0(x)\sin(n\pi x/L)\,dx.
$$
<Orthogonality> of the modes gives
$$
a_n'(t)=\left(f'(0)-D(n\pi/L)^2\right)a_n(t).
$$
Thus each mode grows or decays exponentially with its own <eigenvalue>, and the largest growth rate is the $n=1$ value. Strict <linear stability analysis>, meaning decay of every mode, is equivalent to
$$
\boxed{L<\pi\sqrt{\frac D{f'(0)}}.}
$$
At equality the first mode is neutral in the <linearization>; the nonlinear terms decide its subsequent behavior. Above this length the first mode grows, giving linear instability.