From patchwork Wed Jun 25 15:40:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 32494 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 35CDD20C88 for ; Wed, 25 Jun 2014 15:43:06 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wm4sf11317904obc.11 for ; Wed, 25 Jun 2014 08:43:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=C5OvSfvbsuFgFt+LqYjBRUfhKQLA3P3qY/O0EJmM1dY=; b=hm6GpcBYksxEkEfaeJOeBFaiFo7wLWBgfy+Jx+iJAJmW5LALa+2eLESQmCft+JW+JT ro70cS2fTwu6RVRdh3hXbeENhNWSOj28J2eHsg/tvVGDLVv7fT9SG/kGMV8/mh6S8AR7 xnF3p39NqDs6BwuABeK1LBK3xAyAzM1K2VhZqSO73/w++lU2BwkTCMcF548PEJOaPvML LngAj1G90gZGVw/Wt0JOrP0CMDohEcoAqESJ7+T6l1swAP3I1Yd9T5LdOCHQWZEtJNoS HCe7yaI8WtofFsR9qcTdYB7ZNm4jYAfGg2YGC0p0hTVM28/5Lx9H8GRK2z8AADIgFeEa qE7w== X-Gm-Message-State: ALoCoQlJ9l2ubx3qS4QrbdNu3oSeCnt1lIfSUz77ylNNZfdqYHFuXKSK+0fimsvPJm/U6DcQnIuR X-Received: by 10.182.197.172 with SMTP id iv12mr4440072obc.1.1403710985819; Wed, 25 Jun 2014 08:43:05 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.29.183 with SMTP id b52ls1298065qgb.54.gmail; Wed, 25 Jun 2014 08:43:05 -0700 (PDT) X-Received: by 10.52.121.197 with SMTP id lm5mr1068228vdb.74.1403710985679; Wed, 25 Jun 2014 08:43:05 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id xk1si2535887vdc.56.2014.06.25.08.43.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Jun 2014 08:43:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id hy10so2094768vcb.31 for ; Wed, 25 Jun 2014 08:43:05 -0700 (PDT) X-Received: by 10.58.182.234 with SMTP id eh10mr2609137vec.41.1403710985604; Wed, 25 Jun 2014 08:43:05 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp299715vcb; Wed, 25 Jun 2014 08:43:05 -0700 (PDT) X-Received: by 10.224.34.73 with SMTP id k9mr13241321qad.11.1403710985148; Wed, 25 Jun 2014 08:43:05 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id c93si5204976qgf.89.2014.06.25.08.43.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jun 2014 08:43:05 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WzpKi-0002gF-Gx; Wed, 25 Jun 2014 15:42:00 +0000 Received: from mail-we0-f176.google.com ([74.125.82.176]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WzpJo-00025u-ED for linux-arm-kernel@lists.infradead.org; Wed, 25 Jun 2014 15:41:09 +0000 Received: by mail-we0-f176.google.com with SMTP id u56so2304086wes.7 for ; Wed, 25 Jun 2014 08:40:42 -0700 (PDT) X-Received: by 10.180.89.101 with SMTP id bn5mr7637928wib.74.1403710841942; Wed, 25 Jun 2014 08:40:41 -0700 (PDT) Received: from marmot.wormnet.eu (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id i3sm54967269wiz.13.2014.06.25.08.40.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jun 2014 08:40:41 -0700 (PDT) From: Steve Capper To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, linux@arm.linux.org.uk, linux-arch@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 4/6] arm: mm: Enable RCU fast_gup Date: Wed, 25 Jun 2014 16:40:22 +0100 Message-Id: <1403710824-24340-5-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1403710824-24340-1-git-send-email-steve.capper@linaro.org> References: <1403710824-24340-1-git-send-email-steve.capper@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140625_084104_696230_6A58FC9E X-CRM114-Status: GOOD ( 11.40 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.176 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.176 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: anders.roxell@linaro.org, peterz@infradead.org, gary.robertson@linaro.org, will.deacon@arm.com, Steve Capper , akpm@linux-foundation.org, christoffer.dall@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: steve.capper@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Activate the RCU fast_gup for ARM. We also need to force THP splits to broadcast an IPI s.t. we block in the fast_gup page walker. As THP splits are comparatively rare, this should not lead to a noticeable performance degradation. Some pre-requisite functions pud_write and pud_page are also added. Signed-off-by: Steve Capper --- arch/arm/Kconfig | 4 ++++ arch/arm/include/asm/pgtable-3level.h | 8 ++++++++ arch/arm/mm/flush.c | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 888bc8a..6d86ff6 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1712,6 +1712,10 @@ config ARCH_SELECT_MEMORY_MODEL config HAVE_ARCH_PFN_VALID def_bool ARCH_HAS_HOLES_MEMORYMODEL || !SPARSEMEM +config HAVE_RCU_GUP + def_bool y + depends on ARM_LPAE + config HIGHMEM bool "High Memory Support" depends on MMU diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h index b286ba9..fa8dcb2 100644 --- a/arch/arm/include/asm/pgtable-3level.h +++ b/arch/arm/include/asm/pgtable-3level.h @@ -219,6 +219,8 @@ static inline pte_t pte_mkspecial(pte_t pte) #define __HAVE_ARCH_PMD_WRITE #define pmd_write(pmd) (!(pmd_val(pmd) & PMD_SECT_RDONLY)) +#define pud_write(pud) (0) +#define pud_page(pud) pmd_page(__pmd(pud_val(pud))) #define pmd_hugewillfault(pmd) (!pmd_young(pmd) || !pmd_write(pmd)) #define pmd_thp_or_huge(pmd) (pmd_huge(pmd) || pmd_trans_huge(pmd)) @@ -226,6 +228,12 @@ static inline pte_t pte_mkspecial(pte_t pte) #ifdef CONFIG_TRANSPARENT_HUGEPAGE #define pmd_trans_huge(pmd) (pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT)) #define pmd_trans_splitting(pmd) (pmd_val(pmd) & PMD_SECT_SPLITTING) + +#ifdef CONFIG_HAVE_RCU_TABLE_FREE +#define __HAVE_ARCH_PMDP_SPLITTING_FLUSH +void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address, + pmd_t *pmdp); +#endif #endif #define PMD_BIT_FUNC(fn,op) \ diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c index 43d54f5..9422820 100644 --- a/arch/arm/mm/flush.c +++ b/arch/arm/mm/flush.c @@ -400,3 +400,22 @@ void __flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned l */ __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE); } + +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +#ifdef CONFIG_HAVE_RCU_TABLE_FREE +static void thp_splitting_flush_sync(void *arg) +{ +} + +void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address, + pmd_t *pmdp) +{ + pmd_t pmd = pmd_mksplitting(*pmdp); + VM_BUG_ON(address & ~PMD_MASK); + set_pmd_at(vma->vm_mm, address, pmdp, pmd); + + /* dummy IPI to serialise against fast_gup */ + smp_call_function(thp_splitting_flush_sync, NULL, 1); +} +#endif /* CONFIG_HAVE_RCU_TABLE_FREE */ +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */