[RFC 7/7] Switch of PF_MEMALLOC during writeout

From: Christoph Lameter
Date: Mon Aug 20 2007 - 17:56:01 EST


Switch off PF_MEMALLOC during both direct and kswapd reclaim.

This works because we are not holding any locks at that point because
reclaim is essentially complete. The write occurs when the memory on
the zones is at the high water mark so it is unlikely that writeout
will get into trouble. If so then reclaim can be called recursively to
reclaim more pages.

Signed-off-by: Christoph Lameter <clameter@xxxxxxx>

---
mm/vmscan.c | 10 ++++++++++
1 file changed, 10 insertions(+)

Index: linux-2.6/mm/vmscan.c
===================================================================
--- linux-2.6.orig/mm/vmscan.c 2007-08-19 23:53:47.000000000 -0700
+++ linux-2.6/mm/vmscan.c 2007-08-19 23:55:29.000000000 -0700
@@ -1227,8 +1227,16 @@ out:

zone->prev_priority = priority;
}
+
+ /*
+ * Trigger writeout. Drop PF_MEMALLOC for writeback
+ * since we are holding no locks. Callbacks into
+ * reclaim should be fine
+ */
+ current->flags &= ~PF_MEMALLOC;
nr_reclaimed += shrink_page_list(&laundry, &sc, NULL);
release_lru_pages(&laundry);
+ current->flags |= PF_MEMALLOC;
return ret;
}

@@ -1406,8 +1414,10 @@ out:

goto loop_again;
}
+ current->flags &= ~PF_MEMALLOC;
nr_reclaimed += shrink_page_list(&laundry, &sc, NULL);
release_lru_pages(&laundry);
+ current->flags |= PF_MEMALLOC;
return nr_reclaimed;
}


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