Re: [PATCH 2/3] fadvise: Add _VOLATILE,_ISVOLATILE, and _NONVOLATILEflags

From: John Stultz
Date: Tue Apr 24 2012 - 15:51:04 EST


On 04/24/2012 12:20 PM, Peter Zijlstra wrote:
On Tue, 2012-04-24 at 10:49 -0700, John Stultz wrote:
+/*
+ * Purges volatile ranges when under memory pressure
+ */
+static int volatile_shrink(struct shrinker *ignored, struct shrink_control *sc)
+{
Hmm, I would have expected regular page reclaim to know about this
instead of using a shrinker interface. Is this done specifically to
avoid growing small holes in all ranges and instead dump entire ranges
thereby keeping other ranges usable?

So yes. We don't want to have single pages purged from the ranges. My first attempt used the standard writeout method to do the purging. However, since the ranges in their entirety should be purged at once (since if any single page is purged, the entire range must be reconstructed), keeping track of the least-recently-unpinned range is more useful then the least-recently-used page.

Now, Dave Chinner suggested using tags to mark pages as part of a volatile range, as well as tracking their purged status, then iterating over adjacent pages on writeout to also purge the entire range, which could be done, but seemed more costly to iterate over each page updating the tags when marking or unmarking a range as volatile. This suggestion was also (as I understood) mainly to address the memory overhead of early implementation adding a pointer to each address_space structure. That issue was resolved by using the hash table for address_space -> range_tree mappings.

thanks
-john

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/