From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yh0-f52.google.com (mail-yh0-f52.google.com [209.85.213.52]) by kanga.kvack.org (Postfix) with ESMTP id 8028B6B0037 for ; Thu, 12 Dec 2013 13:00:54 -0500 (EST) Received: by mail-yh0-f52.google.com with SMTP id i7so605908yha.11 for ; Thu, 12 Dec 2013 10:00:54 -0800 (PST) Date: Thu, 12 Dec 2013 12:00:50 -0600 From: Alex Thorlton Subject: [RFC PATCH 2/3] Add tunable to control THP behavior Message-ID: <20131212180050.GC134240@sgi.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org Cc: Andrew Morton , "Kirill A. Shutemov" , Benjamin Herrenschmidt , Rik van Riel , Wanpeng Li , Mel Gorman , Michel Lespinasse , Benjamin LaHaise , Oleg Nesterov , "Eric W. Biederman" , Andy Lutomirski , Al Viro , David Rientjes , Zhang Yanfei , Peter Zijlstra , Johannes Weiner , Michal Hocko , Jiang Liu , Cody P Schafer , Glauber Costa , Kamezawa Hiroyuki , Naoya Horiguchi , linux-kernel@vger.kernel.org This part of the patch adds a tunable to /sys/kernel/mm/transparent_hugepage called threshold. This threshold determines how many pages a user must fault in from a single node before a temporary compound page is turned into a THP. Signed-off-by: Alex Thorlton Cc: Andrew Morton Cc: Nate Zimmer Cc: Cliff Wickman Cc: "Kirill A. Shutemov" Cc: Benjamin Herrenschmidt Cc: Rik van Riel Cc: Wanpeng Li Cc: Mel Gorman Cc: Michel Lespinasse Cc: Benjamin LaHaise Cc: Oleg Nesterov Cc: "Eric W. Biederman" Cc: Andy Lutomirski Cc: Al Viro Cc: David Rientjes Cc: Zhang Yanfei Cc: Peter Zijlstra Cc: Johannes Weiner Cc: Michal Hocko Cc: Jiang Liu Cc: Cody P Schafer Cc: Glauber Costa Cc: Kamezawa Hiroyuki Cc: David Rientjes Cc: Naoya Horiguchi Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org --- include/linux/huge_mm.h | 2 ++ include/linux/mm_types.h | 1 + mm/huge_memory.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 3935428..0943b1b6 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -177,6 +177,8 @@ static inline struct page *compound_trans_head(struct page *page) extern int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, pmd_t pmd, pmd_t *pmdp); +extern int thp_threshold_check(void); + #else /* CONFIG_TRANSPARENT_HUGEPAGE */ #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) #define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; }) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index d9851ee..b5efa23 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -408,6 +408,7 @@ struct mm_struct { #endif #ifdef CONFIG_TRANSPARENT_HUGEPAGE pgtable_t pmd_huge_pte; /* protected by page_table_lock */ + int thp_threshold; #endif #ifdef CONFIG_CPUMASK_OFFSTACK struct cpumask cpumask_allocation; diff --git a/mm/huge_memory.c b/mm/huge_memory.c index cca80d9..5d388e4 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -44,6 +44,9 @@ unsigned long transparent_hugepage_flags __read_mostly = (1< HPAGE_PMD_NR) + return -EINVAL; + + transparent_hugepage_threshold = value; + + return count; +} +static struct kobj_attribute threshold_attr = + __ATTR(threshold, 0644, threshold_show, threshold_store); #ifdef CONFIG_DEBUG_VM static ssize_t debug_cow_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -397,6 +426,7 @@ static struct kobj_attribute debug_cow_attr = static struct attribute *hugepage_attr[] = { &enabled_attr.attr, &defrag_attr.attr, + &threshold_attr.attr, &use_zero_page_attr.attr, #ifdef CONFIG_DEBUG_VM &debug_cow_attr.attr, -- 1.7.12.4 -- 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