From 8400266b1947f618150e7e4cd3919c4f7fc6877e Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Mon, 21 Sep 2009 17:03:33 -0700 Subject: [PATCH] --- yaml --- r: 164475 b: refs/heads/master c: 3ae77f43b1118a76ea37952d444319c15e002c03 h: refs/heads/master i: 164473: f7297ce21df606f8ff63d1aed2898d23c44ae802 164471: f1ae49aa536c04b7775aaea56cfab92c6f4b337e v: v3 --- [refs] | 2 +- trunk/mm/hugetlb.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 37ce1cd61f7e..0691bc9fecf9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6e919717c82c5773ac671816c8392c70d261685f +refs/heads/master: 3ae77f43b1118a76ea37952d444319c15e002c03 diff --git a/trunk/mm/hugetlb.c b/trunk/mm/hugetlb.c index 6b41f70bbc7f..815dbd4a6dcb 100644 --- a/trunk/mm/hugetlb.c +++ b/trunk/mm/hugetlb.c @@ -2016,8 +2016,11 @@ static struct page *hugetlbfs_pagecache_page(struct hstate *h, return find_lock_page(mapping, idx); } -/* Return whether there is a pagecache page to back given address within VMA */ -static bool hugetlbfs_backed(struct hstate *h, +/* + * Return whether there is a pagecache page to back given address within VMA. + * Caller follow_hugetlb_page() holds page_table_lock so we cannot lock_page. + */ +static bool hugetlbfs_pagecache_present(struct hstate *h, struct vm_area_struct *vma, unsigned long address) { struct address_space *mapping; @@ -2254,10 +2257,13 @@ int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, /* * When coredumping, it suits get_dump_page if we just return - * an error if there's a hole and no huge pagecache to back it. + * an error where there's an empty slot with no huge pagecache + * to back it. This way, we avoid allocating a hugepage, and + * the sparse dumpfile avoids allocating disk blocks, but its + * huge holes still show up with zeroes where they need to be. */ - if (absent && - ((flags & FOLL_DUMP) && !hugetlbfs_backed(h, vma, vaddr))) { + if (absent && (flags & FOLL_DUMP) && + !hugetlbfs_pagecache_present(h, vma, vaddr)) { remainder = 0; break; }