The question of optimal spanwise-periodic modification for the stabilisation of spanwise-invariant flows is addressed. A second-order sensitivity analysis is conducted for the linear temporal stability of parallel flows
$U_{0}$ subject to small-amplitude spanwise-periodic modification
${\it\epsilon}U_{1},{\it\epsilon}\ll 1$. It is known that spanwise-periodic flow modifications have a quadratic effect on stability properties, i.e. the first-order eigenvalue variation is zero, hence the need for a second-order analysis. A second-order sensitivity operator is computed from a one-dimensional calculation, which allows one to predict how eigenvalues are affected by any flow modification
$U_{1}$, without actually solving for modified eigenvalues and eigenmodes. Comparisons with full two-dimensional stability calculations in a plane channel flow and in a mixing layer show excellent agreement. Next, optimisation is performed on the second-order sensitivity operator: for each eigenmode streamwise wavenumber
${\it\alpha}_{0}$ and base flow modification spanwise wavenumber
${\it\beta}$, the most stabilising/destabilising profiles
$U_{1}$ are computed, together with lower/upper bounds for the variation in leading eigenvalue. These bounds increase like
${\it\beta}^{-2}$ as
${\it\beta}$ goes to zero, thus yielding a large stabilising potential. However, three-dimensional modes with wavenumbers
${\it\beta}_{0}=\pm {\it\beta}$,
$\pm {\it\beta}/2$ are destabilised, and therefore larger control wavenumbers should be preferred. The most stabilising
$U_{1}$ optimised for the most unstable streamwise wavenumber
${\it\alpha}_{0,max}$ has a stabilising effect on modes with other
${\it\alpha}_{0}$ values too. Finally, the potential of transient growth to amplify perturbations and stabilise the flow is assessed with a combined optimisation. Assuming a separation of time scales between the fast unstable mode and the slow transient evolution of the optimal perturbations, combined optimal perturbations that achieve the best balance between transient linear amplification and stabilisation of the nominal shear flow are determined. In the mixing layer with
${\it\beta}\leqslant 1.5$, these combined optimal perturbations appear similar to transient growth-only optimal perturbations, and achieve a more efficient overall stabilisation than optimal spanwise-periodic and spanwise-invariant modifications computed for stabilisation only. These results are consistent with the efficiency of streak-based control strategies.