Calculating tmpfs Swap Usage
This surprisingly seems to be undocumented; I say "surprisingly" because any system using POSIX shared memory or tmpfs filesystems will have skewed "free" output if any of that memory is swapped out.
Unlike SYSV shared memory (visible with ipcs -u), POSIX shared memory doesn't have a documented record of the number of resident/swap pages. Luckily, nr_shmem in /proc/vmstat, in testing and from what I can gather from the page reclaim code in mm/filemap.c, reports only the number of resident shared memory pages. This makes calculating shared swap usage trivial:
What does this mean? It means that we can get a more accurate portrayal of what is really available in physical memory, right now (for brevity, some of this is borrowed, yet again, from Jon Miller). This assumes that the above script has already been run: