AFAIK, this cannot work. The swap code does not go through the filesystem, it bypasses the filesystem (it only asks the filesystem code for the swap file extents during the "swapon" call), and it's the filesystem that would be responsible for allocating disk space when writing to a sparse file.
$ du /swapfile
329696 /swapfile
$ du --apparent-size /swapfile
33554432 /swapfile
Looks to me like it's behaving as expected?
Moreover, if your working set is larger than RAM, you're screwed regardless. So don't do that. Swap exists so you can use more RAM for the disk cache. It's doesn't exist so that buggy programs can crawl instead of dying
I mean, this is patently false. I've used 1TB swapfiles to get out of a sticky situation with some terrible research software that used a ton of memory to solve really valuable problems.
There's nothing wrong with an absolute shit ton of swap when the alternative is OOM.
In this case "reorganized" or "repartitioned" could probably be more apt.
If we'd talked about software here (and not disk layout), I'd have considered less leniently the use of "refactoring", and a hint of unclear intentions.
Sorry for being so nitpicky, but this is a sore thumb from too many "refactorings" that are, indeed, somenthing else.
Instead of being sorry for being nitpicky, maybe just keep your nitpicks to yourself in future.