From patchwork Fri Oct 18 13:07:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 21129 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EDE70202FF for ; Fri, 18 Oct 2013 13:07:37 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id i13sf1748333qae.9 for ; Fri, 18 Oct 2013 06:07:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=a55hPtfSTBIMQBknhdw13fc2gSRQ/nctjHnzi0pSHBo=; b=mpoUFUx6Sc70r6lK+iw69iXShQPZwaNwWcl39qvj6ZKdH4y9mS7RCwSgILHH+YOw41 oQhZygSJt7wvNvsudu7oU2Dujd0Jq0vmyhAnKakMAxdYBorsbqjqRs/meEA3o2dcbnsR LeJhrwV2djJZl5GSUjoCN2qII3Mw4hXoUNcTWOyc8mwPu3EuliUChnAdwOy/ASNKoDju T1qM0NXv1lZGRm4b0wRZHEnOMNzqLunyG6xYJ2/iFT74EdPnV1VFTa/27edZcNX1Dl8g i8bd+mcoTpA/+WLJijdsxdlAkAIVw4nK3/8ep+uPFJqwzNhvbcA4jjj5NIgVUAcbhe1C 0clQ== X-Received: by 10.58.182.167 with SMTP id ef7mr1114468vec.15.1382101657754; Fri, 18 Oct 2013 06:07:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.1.102 with SMTP id 6ls1251328qel.40.gmail; Fri, 18 Oct 2013 06:07:37 -0700 (PDT) X-Received: by 10.58.233.98 with SMTP id tv2mr2012141vec.11.1382101657589; Fri, 18 Oct 2013 06:07:37 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id bl10si296572vcb.9.2013.10.18.06.07.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 06:07:37 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id pa12so1943137veb.6 for ; Fri, 18 Oct 2013 06:07:37 -0700 (PDT) X-Gm-Message-State: ALoCoQkJdSWIc0GGYWtBof7JZuKN+eeKLt59nked1ls/2/1MEs6ZkrEOjtoqf+3NZ+wHcFBy88Kp X-Received: by 10.58.217.130 with SMTP id oy2mr311812vec.24.1382101657450; Fri, 18 Oct 2013 06:07:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp34271vcz; Fri, 18 Oct 2013 06:07:36 -0700 (PDT) X-Received: by 10.180.211.111 with SMTP id nb15mr2333185wic.55.1382101656530; Fri, 18 Oct 2013 06:07:36 -0700 (PDT) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by mx.google.com with ESMTPS id gd10si4265503wic.44.2013.10.18.06.07.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 06:07:36 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.173 is neither permitted nor denied by best guess record for domain of steve.capper@linaro.org) client-ip=209.85.212.173; Received: by mail-wi0-f173.google.com with SMTP id ey11so953766wid.0 for ; Fri, 18 Oct 2013 06:07:36 -0700 (PDT) X-Received: by 10.180.210.243 with SMTP id mx19mr2789188wic.35.1382101656097; Fri, 18 Oct 2013 06:07:36 -0700 (PDT) Received: from marmot.wormnet.eu (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id b13sm26895389wic.9.2013.10.18.06.07.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Oct 2013 06:07:35 -0700 (PDT) From: Steve Capper To: linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Cc: Andrea Arcangeli , Christoffer Dall , Will Deacon , Russell King , Zi Shen Lim , patches@linaro.org, linaro-kernel@lists.linaro.org, Steve Capper Subject: [RFC PATCH 1/2] thp: Introduce arch_(un)block_thp_split Date: Fri, 18 Oct 2013 14:07:12 +0100 Message-Id: <1382101634-4723-2-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1382101634-4723-1-git-send-email-steve.capper@linaro.org> References: <1382101634-4723-1-git-send-email-steve.capper@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: steve.capper@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In kernel/futex.c an assumption is made in the THP tail pinning code that disabling the irqs is sufficient to block the THP splitting code from completing. Architectures such as ARM do hardware TLB broadcasts so disabling the irqs will not prevent a THP split from completing. This patch introduces: arch_block_thp_split and arch_unblock_thp_split, and provides stock implementations that observe the original irq enable and disable behaviour. One can then define these macros themselves to implement architecture specific behaviour. Signed-off-by: Steve Capper --- include/linux/huge_mm.h | 16 ++++++++++++++++ kernel/futex.c | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 3935428..35fb742 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -177,6 +177,14 @@ 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); +#ifndef arch_block_thp_split +#define arch_block_thp_split(mm) local_irq_disable() +#endif + +#ifndef arch_unblock_thp_split +#define arch_unblock_thp_split(mm) local_irq_enable() +#endif + #else /* CONFIG_TRANSPARENT_HUGEPAGE */ #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) #define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; }) @@ -227,6 +235,14 @@ static inline int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_str return 0; } +#ifndef arch_block_thp_split +#define arch_block_thp_split(mm) do { } while (0) +#endif + +#ifndef arch_unblock_thp_split +#define arch_unblock_thp_split(mm) do { } while (0) +#endif + #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #endif /* _LINUX_HUGE_MM_H */ diff --git a/kernel/futex.c b/kernel/futex.c index c3a1a55..e016ff2 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -287,7 +287,7 @@ again: if (unlikely(PageTail(page))) { put_page(page); /* serialize against __split_huge_page_splitting() */ - local_irq_disable(); + arch_block_thp_split(mm); if (likely(__get_user_pages_fast(address, 1, 1, &page) == 1)) { page_head = compound_head(page); /* @@ -304,9 +304,9 @@ again: get_page(page_head); put_page(page); } - local_irq_enable(); + arch_unblock_thp_split(mm); } else { - local_irq_enable(); + arch_unblock_thp_split(mm); goto again; } }