While that does not disable swap, it makes its usage possible only in very extreme low-memory situations, which I think is better than crashing the VM for OOM.
That will indeed work better than disabling swap completely, though I believe using this with zram-based swap could be less-than-ideal for performance.