From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail203.messagelabs.com (mail203.messagelabs.com [216.82.254.243]) by kanga.kvack.org (Postfix) with SMTP id 9AC2F6B007B for ; Thu, 21 Jan 2010 01:51:28 -0500 (EST) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [PATCH 19 of 30] ensure mapcount is taken on head pages Message-Id: <8a02c04d705157e09086.1264054843@v2.random> In-Reply-To: References: Date: Thu, 21 Jan 2010 07:20:43 +0100 From: Andrea Arcangeli Sender: owner-linux-mm@kvack.org To: linux-mm@kvack.org Cc: Marcelo Tosatti , Adam Litke , Avi Kivity , Izik Eidus , Hugh Dickins , Nick Piggin , Rik van Riel , Mel Gorman , Andi Kleen , Dave Hansen , Benjamin Herrenschmidt , Ingo Molnar , Mike Travis , KAMEZAWA Hiroyuki , Christoph Lameter , Chris Wright Dave Hansen , Andrew Morton List-ID: From: Andrea Arcangeli Unlike the page count, the page mapcount cannot be taken on PageTail compound pages. Signed-off-by: Andrea Arcangeli --- diff --git a/include/linux/rmap.h b/include/linux/rmap.h --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -105,6 +105,7 @@ void page_remove_rmap(struct page *); static inline void page_dup_rmap(struct page *page) { + VM_BUG_ON(PageTail(page)); atomic_inc(&page->_mapcount); } diff --git a/mm/rmap.c b/mm/rmap.c --- a/mm/rmap.c +++ b/mm/rmap.c @@ -674,6 +674,7 @@ void page_add_anon_rmap(struct page *pag struct vm_area_struct *vma, unsigned long address) { int first = atomic_inc_and_test(&page->_mapcount); + VM_BUG_ON(PageTail(page)); if (first) __inc_zone_page_state(page, NR_ANON_PAGES); if (unlikely(PageKsm(page))) @@ -701,6 +702,7 @@ void page_add_new_anon_rmap(struct page struct vm_area_struct *vma, unsigned long address) { VM_BUG_ON(address < vma->vm_start || address >= vma->vm_end); + VM_BUG_ON(PageTail(page)); SetPageSwapBacked(page); atomic_set(&page->_mapcount, 0); /* increment count (starts at -1) */ __inc_zone_page_state(page, NR_ANON_PAGES); @@ -733,6 +735,7 @@ void page_add_file_rmap(struct page *pag */ void page_remove_rmap(struct page *page) { + VM_BUG_ON(PageTail(page)); /* page still mapped by someone else? */ if (!atomic_add_negative(-1, &page->_mapcount)) return; @@ -1281,6 +1284,7 @@ static int rmap_walk_file(struct page *p int rmap_walk(struct page *page, int (*rmap_one)(struct page *, struct vm_area_struct *, unsigned long, void *), void *arg) { + VM_BUG_ON(PageTail(page)); VM_BUG_ON(!PageLocked(page)); if (unlikely(PageKsm(page))) -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org