From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail143.messagelabs.com (mail143.messagelabs.com [216.82.254.35]) by kanga.kvack.org (Postfix) with ESMTP id E3A028D0039 for ; Wed, 9 Feb 2011 14:54:41 -0500 (EST) Received: from d01dlp02.pok.ibm.com (d01dlp02.pok.ibm.com [9.56.224.85]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p19JZJZP012533 for ; Wed, 9 Feb 2011 14:36:02 -0500 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 58EA54DE8040 for ; Wed, 9 Feb 2011 14:53:47 -0500 (EST) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p19JsIqh1396802 for ; Wed, 9 Feb 2011 14:54:18 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p19JsGbu012796 for ; Wed, 9 Feb 2011 17:54:18 -0200 Subject: [PATCH 4/5] teach smaps_pte_range() about THP pmds From: Dave Hansen Date: Wed, 09 Feb 2011 11:54:11 -0800 References: <20110209195406.B9F23C9F@kernel> In-Reply-To: <20110209195406.B9F23C9F@kernel> Message-Id: <20110209195411.816D55A7@kernel> Sender: owner-linux-mm@kvack.org List-ID: To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, Michael J Wolf , Andrea Arcangeli , Dave Hansen , Johannes Weiner , David Rientjes This adds code to explicitly detect and handle pmd_trans_huge() pmds. It then passes HPAGE_SIZE units in to the smap_pte_entry() function instead of PAGE_SIZE. This means that using /proc/$pid/smaps now will no longer cause THPs to be broken down in to small pages. Signed-off-by: Dave Hansen Acked-by: Johannes Weiner Acked-by: David Rientjes --- linux-2.6.git-dave/fs/proc/task_mmu.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff -puN fs/proc/task_mmu.c~teach-smaps_pte_range-about-thp-pmds fs/proc/task_mmu.c --- linux-2.6.git/fs/proc/task_mmu.c~teach-smaps_pte_range-about-thp-pmds 2011-02-09 11:41:43.919557155 -0800 +++ linux-2.6.git-dave/fs/proc/task_mmu.c 2011-02-09 11:41:43.927557149 -0800 @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -7,6 +8,7 @@ #include #include #include +#include #include #include @@ -385,8 +387,16 @@ static int smaps_pte_range(pmd_t *pmd, u pte_t *pte; spinlock_t *ptl; - split_huge_page_pmd(walk->mm, pmd); - + if (pmd_trans_huge(*pmd)) { + if (pmd_trans_splitting(*pmd)) { + spin_unlock(&walk->mm->page_table_lock); + wait_split_huge_page(vma->anon_vma, pmd); + spin_lock(&walk->mm->page_table_lock); + } else { + smaps_pte_entry(*(pte_t *)pmd, addr, HPAGE_SIZE, walk); + return 0; + } + } pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); for (; addr != end; pte++, addr += PAGE_SIZE) smaps_pte_entry(*pte, addr, PAGE_SIZE, walk); _ -- 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/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org