[PATCH] fadvise volatile fixes from Dmitry

From: John Stultz
Date: Fri Mar 16 2012 - 20:47:44 EST


On 03/16/2012 03:51 PM, John Stultz wrote:
This patch provides new fadvise flags that can be used to mark
file pages as volatile, which will allow it to be discarded if the
kernel wants to reclaim memory.
Right after sending this I realized I had forgotten to include
some fixes for issues Dmitry pointed out. So I've included them
here.

Signed-off-by: John Stultz<john.stultz@xxxxxxxxxx>
---
mm/volatile.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/volatile.c b/mm/volatile.c
index e412a8b..f40c02e 100644
--- a/mm/volatile.c
+++ b/mm/volatile.c
@@ -220,11 +220,12 @@ long mapping_range_nonvolatile(struct address_space *mapping,
new->mapping = mapping;
new->range_node.start = end + 1;
new->range_node.end = node->end;
- volatile_range_resize(vrange, node->start, start-1);
+ new->purged = vrange->purged;
range_tree_add(&mapping->volatile_root,
&new->range_node);
if (range_on_lru(new))
lru_add(new);
+ volatile_range_resize(vrange, node->start, start-1);

break;
}
@@ -263,7 +264,7 @@ void mapping_clear_volatile_ranges(struct address_space *mapping)
static int volatile_shrink(struct shrinker *ignored, struct shrink_control *sc)
{
struct volatile_range *range, *next;
- unsigned long nr_to_scan = sc->nr_to_scan;
+ s64 nr_to_scan = sc->nr_to_scan;
const gfp_t gfp_mask = sc->gfp_mask;

if (nr_to_scan&& !(gfp_mask& __GFP_FS))
--
1.7.3.2.146.gca209



--
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/