From: Johannes Weiner Date: Thu, 8 Dec 2011 04:41:49 +0000 (+1100) Subject: mm: filemap: pass __GFP_WRITE from grab_cache_page_write_begin() X-Git-Tag: next-20111214~2^2~130 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=261d9d93c455b0cd50024e26df29230c1f974b2b;p=karo-tx-linux.git mm: filemap: pass __GFP_WRITE from grab_cache_page_write_begin() Tell the page allocator that pages allocated through grab_cache_page_write_begin() are expected to become dirty soon. Signed-off-by: Johannes Weiner Reviewed-by: Rik van Riel Acked-by: Mel Gorman Reviewed-by: Minchan Kim Reviewed-by: Michal Hocko Cc: KAMEZAWA Hiroyuki Cc: Christoph Hellwig Cc: Wu Fengguang Cc: Dave Chinner Cc: Jan Kara Cc: Shaohua Li Cc: Chris Mason Signed-off-by: Andrew Morton --- diff --git a/mm/filemap.c b/mm/filemap.c index 0d2a0cbcfe32..a7b572b15fd9 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2354,8 +2354,11 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping, pgoff_t index, unsigned flags) { int status; + gfp_t gfp_mask; struct page *page; gfp_t gfp_notmask = 0; + + gfp_mask = mapping_gfp_mask(mapping) | __GFP_WRITE; if (flags & AOP_FLAG_NOFS) gfp_notmask = __GFP_FS; repeat: @@ -2363,7 +2366,7 @@ repeat: if (page) goto found; - page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~gfp_notmask); + page = __page_cache_alloc(gfp_mask & ~gfp_notmask); if (!page) return NULL; status = add_to_page_cache_lru(page, mapping, index,