  We study sharp growth conditions for the boundedness of the Hardy-Littlewood
maximal function in the generalized Orlicz spaces. We assume that the
generalized Orlicz function $\phi(x, t)$ satisfies the standard continuity
properties (A0), (A1) and (A2). We show that if the Hardy-Littlewood maximal
function is bounded from the generalized Orlicz space to itself then
$\phi(x,t)/ t^p$ is almost increasing for large $t$ for some $p>1$. Moreover we
show that the Hardy-Littlewood maximal function is bounded from the generalized
Orlicz space $L^\phi(\mathbb{R}^n)$ to itself if and only if $\phi$ is weakly
equivalent to a generalized Orlicz function $\psi$ satisfying (A0), (A1) and
(A2) for which $\psi(x,t)/ t^p$ is almost increasing for all $t>0$ and some
$p>1$.
