That's because when your application exits, zap_pte_range frees page and
swap for the present ptes, but only swap_free for the non-present ptes:
sometimes that brings the swap count down to 1 (still used), but that 1
corresponds to page remaining in the swap cache which could now be freed.
There's no lookup in that case, intentionally. A patch was posted a few
months ago to do so, but Linus preferred not to add such unmap overhead.
Indeed, for a while we didn't even free swap for the present ptes, but a
number of problems arose from that (maybe now fixed in other ways, but I
don't think we dare to reopen that wormcan).
In due course, when memory pressure demands, reclaim_page (Alan+Rik)
or shrink_cache (Linus+Andrea) will discover those pages and make them
available. Or, as you found, swapoff will free them: one of the reasons
swapoff is now faster is that it no longers searches mms in that case.
Hugh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/