From patchwork Wed Apr 20 18:24:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 66245 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2618493qge; Wed, 20 Apr 2016 11:51:45 -0700 (PDT) X-Received: by 10.66.131.79 with SMTP id ok15mr14553208pab.151.1461178305203; Wed, 20 Apr 2016 11:51:45 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n72si13652716pfj.204.2016.04.20.11.51.44; Wed, 20 Apr 2016 11:51:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751650AbcDTSuv (ORCPT + 29 others); Wed, 20 Apr 2016 14:50:51 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:33571 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750804AbcDTSuu (ORCPT ); Wed, 20 Apr 2016 14:50:50 -0400 Received: by mail-pf0-f172.google.com with SMTP id 184so21139835pff.0 for ; Wed, 20 Apr 2016 11:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=iJzXL/28T3SNVNKPov0Lz58rHZTd/HgvwVvH5DyK4zo=; b=JW6fP8HV1G4KX9gYamdq2s4FcqTA3acTLtfxN3aPF6sqIO9rvX5jiNj6mp9JAgGsKu hKkUJZEsnuzwUhYvfxdpa2XKhwzRFvi4fESGmIE+U/nrGraGQZ++csjRiNZPMALLe4Lq McV7pGvjcLDS9MRGZtJdOmB6hR4ZIjHMXiYk8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=iJzXL/28T3SNVNKPov0Lz58rHZTd/HgvwVvH5DyK4zo=; b=GZ2hngPXLaDZRFNoXVFGudxVn47oSMMTlf6K22F64AzFBRm9+ChyoXQiDfF8ZOtBSN KFPU2CwkMEik7tXip7SHrmPj7IywIgLRVKP+ad17h2kL2UPnwSc0ELY4h1lldBMsdlj6 UUEdM788bTnMjZ14RgcOQG1sfrnrWciTcDjlTJih3q387zSzsjezj7UpYo6onbh5uCf5 1IuR2EBLvPZO+VeQPCCz/qZB2Dw0HmUKe8KjV5sGCNqVAAnzMHEEBI+nRYGjaYZg0Ag+ Bs3q3z9Jfg7aikpktVMnnnJKVM3Ux7LrWTVT3O5AkOLIUpSswIAxATWaZG47+eMUeLne eVAw== X-Gm-Message-State: AOPr4FV3zCqCJwGtpNxRnOnNYu+j2jrsZLe2K0r0WT6YG6ZW9ju3JPa6PQJi1WbStrcenpwK X-Received: by 10.98.16.210 with SMTP id 79mr14379764pfq.69.1461178249450; Wed, 20 Apr 2016 11:50:49 -0700 (PDT) Received: from yshi-Precision-T5600.corp.ad.wrs.com (unknown-216-82.windriver.com. [147.11.216.82]) by smtp.gmail.com with ESMTPSA id 79sm99981567pfq.65.2016.04.20.11.50.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Apr 2016 11:50:48 -0700 (PDT) From: Yang Shi To: akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, aarcange@redhat.com, hughd@google.com, mgorman@suse.de Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linaro-kernel@lists.linaro.org, yang.shi@linaro.org Subject: [PATCH] mm: move huge_pmd_set_accessed out of huge_memory.c Date: Wed, 20 Apr 2016 11:24:58 -0700 Message-Id: <1461176698-9714-1-git-send-email-yang.shi@linaro.org> X-Mailer: git-send-email 2.0.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org huge_pmd_set_accessed is only called by __handle_mm_fault from memory.c, move the definition to memory.c and make it static like create_huge_pmd and wp_huge_pmd. Signed-off-by: Yang Shi --- include/linux/huge_mm.h | 4 ---- mm/huge_memory.c | 23 ----------------------- mm/memory.c | 23 +++++++++++++++++++++++ 3 files changed, 23 insertions(+), 27 deletions(-) -- 2.0.2 diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 7008623..c218ab7b 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -8,10 +8,6 @@ extern int do_huge_pmd_anonymous_page(struct mm_struct *mm, extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr, struct vm_area_struct *vma); -extern void huge_pmd_set_accessed(struct mm_struct *mm, - struct vm_area_struct *vma, - unsigned long address, pmd_t *pmd, - pmd_t orig_pmd, int dirty); extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pmd_t *pmd, pmd_t orig_pmd); diff --git a/mm/huge_memory.c b/mm/huge_memory.c index fecbbc5..6c14cb6 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1137,29 +1137,6 @@ out: return ret; } -void huge_pmd_set_accessed(struct mm_struct *mm, - struct vm_area_struct *vma, - unsigned long address, - pmd_t *pmd, pmd_t orig_pmd, - int dirty) -{ - spinlock_t *ptl; - pmd_t entry; - unsigned long haddr; - - ptl = pmd_lock(mm, pmd); - if (unlikely(!pmd_same(*pmd, orig_pmd))) - goto unlock; - - entry = pmd_mkyoung(orig_pmd); - haddr = address & HPAGE_PMD_MASK; - if (pmdp_set_access_flags(vma, haddr, pmd, entry, dirty)) - update_mmu_cache_pmd(vma, address, pmd); - -unlock: - spin_unlock(ptl); -} - static int do_huge_pmd_wp_page_fallback(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, diff --git a/mm/memory.c b/mm/memory.c index 93897f2..6ced4eb 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3287,6 +3287,29 @@ static int wp_huge_pmd(struct mm_struct *mm, struct vm_area_struct *vma, return VM_FAULT_FALLBACK; } +static void huge_pmd_set_accessed(struct mm_struct *mm, + struct vm_area_struct *vma, + unsigned long address, + pmd_t *pmd, pmd_t orig_pmd, + int dirty) +{ + spinlock_t *ptl; + pmd_t entry; + unsigned long haddr; + + ptl = pmd_lock(mm, pmd); + if (unlikely(!pmd_same(*pmd, orig_pmd))) + goto unlock; + + entry = pmd_mkyoung(orig_pmd); + haddr = address & HPAGE_PMD_MASK; + if (pmdp_set_access_flags(vma, haddr, pmd, entry, dirty)) + update_mmu_cache_pmd(vma, address, pmd); + +unlock: + spin_unlock(ptl); +} + /* * These routines also need to handle stuff like marking pages dirty * and/or accessed for architectures that don't do it in hardware (most