This patch extends vm_pager' table of virtual functions and adds new pager type OBJT_SWAP_TMPFS. In total it eliminates OBJ_TMPFS_NODE flag, replacing conditionals with the pager' method calls. It also eliminate several other checks for OBJT_SWAP and direct calls into swap_* functions.
I still needed some common attribute for OBJT_SWAP and OBJT_SWAP_TMPFS objects, so OBJ_TMPFS_NODE flag is repurposed as OBJ_SWAPPING, indicating any type of the swap object.
I booted the patched kernel multiuser with /tmp on tmpfs, but no other testing was done.
I did not looked at specific tests for other object types, there are definitely more opportunities to simplify the code with another set of vm_pager methods, but only OBJT_SWAP for now.
Interesting next step would be to allow dynamically loadable pagers, so OBJT_SWAP_TMPFS only appers after kldload tmpfs.ko.