From patchwork Tue Feb 18 15:27:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 24892 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 76653202B2 for ; Tue, 18 Feb 2014 15:30:20 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id rl12sf9063945iec.6 for ; Tue, 18 Feb 2014 07:30:19 -0800 (PST) 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=1BmfPNVwG1dvMUnPOO7PJq50hOjI98bSQz/yj5ya63k=; b=NHz+eXdjOV7/mIN2UDO73fH7nxh5IXuehHm6C+rocXO0BoL9e4xrc+eUOm9Zngum/O g5Q+Zn6I939MT0yAXGgF0X2kqPpZ02YvcP9/6cDTy9ByAzDtmUMYWzt/2k/itIVMgPJN rbMCWML5mtI26q9SRQ5V9d/0do+WRmJYFJEQPwX32n8zcCxmHW4slRqsir0lHV9hmsb0 Sxxq+J4jBf390P2BU7NNnfwaIeEfCwg4U3fb+f4Z5n7mM4rR+apYwvUkibJw9T1lhuc9 m7kbl0RzUC7XMvCbM2vbXwvD1oSJxMvpoqDU2lJy/CQilAwkcAlFLc4mirZq6e5rNXgE jknQ== X-Gm-Message-State: ALoCoQmeitm9LsUpri90HZUJ+acdxaVmRIGN2coJhEeNK3leZM0ZvRCwugtY12qLsGHp0+n+PvyT X-Received: by 10.182.60.37 with SMTP id e5mr13201950obr.30.1392737419488; Tue, 18 Feb 2014 07:30:19 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.14 with SMTP id b14ls1403688qga.47.gmail; Tue, 18 Feb 2014 07:30:19 -0800 (PST) X-Received: by 10.52.65.207 with SMTP id z15mr652588vds.61.1392737419345; Tue, 18 Feb 2014 07:30:19 -0800 (PST) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id xn5si503425vdc.146.2014.02.18.07.30.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 07:30:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id le5so13106243vcb.2 for ; Tue, 18 Feb 2014 07:30:19 -0800 (PST) X-Received: by 10.52.248.138 with SMTP id ym10mr18289322vdc.18.1392737419229; Tue, 18 Feb 2014 07:30:19 -0800 (PST) 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.220.174.196 with SMTP id u4csp225165vcz; Tue, 18 Feb 2014 07:30:18 -0800 (PST) X-Received: by 10.180.97.72 with SMTP id dy8mr18413040wib.5.1392737417536; Tue, 18 Feb 2014 07:30:17 -0800 (PST) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id lx7si14986589wjb.39.2014.02.18.07.30.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Feb 2014 07:30:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFmbE-0005eY-4Z; Tue, 18 Feb 2014 15:28:44 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFmb2-0001Ou-50; Tue, 18 Feb 2014 15:28:32 +0000 Received: from mail-wi0-f170.google.com ([209.85.212.170]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WFmaP-0001GG-JE for linux-arm-kernel@lists.infradead.org; Tue, 18 Feb 2014 15:27:58 +0000 Received: by mail-wi0-f170.google.com with SMTP id hi5so3528986wib.5 for ; Tue, 18 Feb 2014 07:27:31 -0800 (PST) X-Received: by 10.180.105.41 with SMTP id gj9mr18508990wib.28.1392737251659; Tue, 18 Feb 2014 07:27:31 -0800 (PST) Received: from marmot.wormnet.eu (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id f3sm43028211wiv.2.2014.02.18.07.27.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Feb 2014 07:27:30 -0800 (PST) From: Steve Capper To: linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk, linux-mm@kvack.org Subject: [PATCH 1/5] mm: hugetlb: Introduce huge_pte_{page,present,young} Date: Tue, 18 Feb 2014 15:27:11 +0000 Message-Id: <1392737235-27286-2-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1392737235-27286-1-git-send-email-steve.capper@linaro.org> References: <1392737235-27286-1-git-send-email-steve.capper@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140218_102753_749152_EB358B7B X-CRM114-Status: GOOD ( 12.85 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.170 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Steve Capper , arnd@arndb.de, catalin.marinas@arm.com, will.deacon@arm.com, dsaxena@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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=neutral (google.com: 209.85.220.171 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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Introduce huge pte versions of pte_page, pte_present and pte_young. This allows ARM (without LPAE) to use alternative pte processing logic for huge ptes. Where these functions are not defined by architectural code they fallback to the standard functions. Signed-off-by: Steve Capper --- include/linux/hugetlb.h | 12 ++++++++++++ mm/hugetlb.c | 22 +++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 8c43cc4..4992487 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -353,6 +353,18 @@ static inline pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma, } #endif +#ifndef huge_pte_page +#define huge_pte_page(pte) pte_page(pte) +#endif + +#ifndef huge_pte_present +#define huge_pte_present(pte) pte_present(pte) +#endif + +#ifndef huge_pte_mkyoung +#define huge_pte_mkyoung(pte) pte_mkyoung(pte) +#endif + static inline struct hstate *page_hstate(struct page *page) { VM_BUG_ON_PAGE(!PageHuge(page), page); diff --git a/mm/hugetlb.c b/mm/hugetlb.c index c01cb9f..d1a38c9 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2319,7 +2319,7 @@ static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page, entry = huge_pte_wrprotect(mk_huge_pte(page, vma->vm_page_prot)); } - entry = pte_mkyoung(entry); + entry = huge_pte_mkyoung(entry); entry = pte_mkhuge(entry); entry = arch_make_huge_pte(entry, vma, page, writable); @@ -2379,7 +2379,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, if (cow) huge_ptep_set_wrprotect(src, addr, src_pte); entry = huge_ptep_get(src_pte); - ptepage = pte_page(entry); + ptepage = huge_pte_page(entry); get_page(ptepage); page_dup_rmap(ptepage); set_huge_pte_at(dst, addr, dst_pte, entry); @@ -2398,7 +2398,7 @@ static int is_hugetlb_entry_migration(pte_t pte) { swp_entry_t swp; - if (huge_pte_none(pte) || pte_present(pte)) + if (huge_pte_none(pte) || huge_pte_present(pte)) return 0; swp = pte_to_swp_entry(pte); if (non_swap_entry(swp) && is_migration_entry(swp)) @@ -2411,7 +2411,7 @@ static int is_hugetlb_entry_hwpoisoned(pte_t pte) { swp_entry_t swp; - if (huge_pte_none(pte) || pte_present(pte)) + if (huge_pte_none(pte) || huge_pte_present(pte)) return 0; swp = pte_to_swp_entry(pte); if (non_swap_entry(swp) && is_hwpoison_entry(swp)) @@ -2464,7 +2464,7 @@ again: goto unlock; } - page = pte_page(pte); + page = huge_pte_page(pte); /* * If a reference page is supplied, it is because a specific * page is being unmapped, not a range. Ensure the page we @@ -2614,7 +2614,7 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long mmun_start; /* For mmu_notifiers */ unsigned long mmun_end; /* For mmu_notifiers */ - old_page = pte_page(pte); + old_page = huge_pte_page(pte); retry_avoidcopy: /* If no-one else is actually using this page, avoid the copy @@ -2965,7 +2965,7 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, * Note that locking order is always pagecache_page -> page, * so no worry about deadlock. */ - page = pte_page(entry); + page = huge_pte_page(entry); get_page(page); if (page != pagecache_page) lock_page(page); @@ -2985,7 +2985,7 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, } entry = huge_pte_mkdirty(entry); } - entry = pte_mkyoung(entry); + entry = huge_pte_mkyoung(entry); if (huge_ptep_set_access_flags(vma, address, ptep, entry, flags & FAULT_FLAG_WRITE)) update_mmu_cache(vma, address, ptep); @@ -3077,7 +3077,7 @@ long follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, } pfn_offset = (vaddr & ~huge_page_mask(h)) >> PAGE_SHIFT; - page = pte_page(huge_ptep_get(pte)); + page = huge_pte_page(huge_ptep_get(pte)); same_page: if (pages) { pages[i] = mem_map_offset(page, pfn_offset); @@ -3425,7 +3425,7 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address, { struct page *page; - page = pte_page(*(pte_t *)pmd); + page = huge_pte_page(*(pte_t *)pmd); if (page) page += ((address & ~PMD_MASK) >> PAGE_SHIFT); return page; @@ -3437,7 +3437,7 @@ follow_huge_pud(struct mm_struct *mm, unsigned long address, { struct page *page; - page = pte_page(*(pte_t *)pud); + page = huge_pte_page(*(pte_t *)pud); if (page) page += ((address & ~PUD_MASK) >> PAGE_SHIFT); return page;