Function swap_pager_swapoff_object calls vm_pager_unswapped (via swp_pager_force_dirty) for every page that must be unswapped. That means that there's an unneeded check for lock ownership (the caller always owns it), a needless PCTRIE_LOOKUP (the caller has already found it), a call to free one page of swap space only, and a checkto see if all blocks are empty, when the caller knows when that check is useless.
Isolate the essential part, needed however swap_pager_unswapped is invoked, into a smaller function swap_pager_unswapped_acct (suggestions for a better name are welcome). From swapoff_object, invoke swp_pager_update_freerange for each appropriate page, so that there are potentially fewer calls to swp_pager_freeseapspace. Only check to see if the complete set of pages is empty after all the pages are processed, right before moving on to the next set of SWAP_META_PAGES pages.