The patch currently posted can't be applied because it includes parts that have already been checked in. This update to that patch is intended to be compatible with head, without changing anythingStarting with D13484, adapt that patch to identify page ranges for swap block release without extra PCTRIE lookups.
I hope these suggestions can help you progress toward a conclusion of your patch.