To maximize the charge of a high-energy electron beam accelerated by an ultra-intense laser pulse propagating in a subcritical plasma, the pulse length should be longer than both the plasma wavelength and the laser pulse width, which is quite different from the standard bubble regime.In addition, the laser-plasma parameters should be chosen to produce the self-trapping regime of relativistic channeling, where the diffraction divergence is balanced by the relativistic nonlinearity such that the laser beam radius is unchanged during pulse propagation in a plasma over many Rayleigh lengths. The condition for such a self-trapping regime is the same as what was empirically found in several previous simulation studies in the form of the pulse width matching condition.Here, we prove these findings for a subcritical plasma, where the total charge of high-energy electrons reaches the multi-nC level, by optimization in a 3D PIC simulation study and compare the results with an analytic theory of relativistic self-focusing. A very efficient explicitly demonstrated generation of high-charge electron beams opens a way to a high-yield production of gammas, positrons, and photonuclear particles.