Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1571385ybp; Fri, 4 Oct 2019 17:36:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxIOz3I3bAE+IvbdpZzNC1+qWiHD4rzOE8Bmtb9W3IQeTvfH3bP6nh7LRxtZ79klu/741G X-Received: by 2002:a50:b582:: with SMTP id a2mr18351694ede.98.1570235802910; Fri, 04 Oct 2019 17:36:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570235802; cv=none; d=google.com; s=arc-20160816; b=paqX80BEbZZSoSKqD7sJRR4xRbYypOWXSlb3P8H4Hx3Q0gyS2aIYS6/s1svXYrXbqS NR4f83l9kYea0tUTnax+v7cpMD4wJvx1Q6BpwjvToRaNoJq7+kJxGKkiMeOdFmLQteCK rUbF2rtk68263hrKyOR541Vkqd9+J6GH+x3uEdDBD+j47e2eNr8rEWHfN27C5duXIocl FPxeN1Quojw4eBLOFAYCvxpGJ3zjuCWW9Xuyd1e+JkIwh2KPoo+nBmeS8aed2wcL2go0 Aj7U25NqNAvbuIRPfqwCXXY+O3KFOBI22MDtMdUwZDvXwfraKopuxVqEGudRtUi9r1Sw uMuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=b89b7fSw20Geh5od70uKaUaqzJkIUT2zfx/A9WP13XA=; b=zBUR8EGszS/WQuYv01Ivum3Si28fFPZD1LRD/WRP1ev6U2gANQHn3Py5RYEzhuTwfT Lv0LoSCTEFgywnhT8HHfS07JfC5iAmHHoGvBE4ZTwxX+5PVcejroZMvjLaA3C4dVcJGI ELSnCzvTkeGEPqtUf9KOsb1GHEt+Sa/mLRx794ZudKTlq0FZ1QLBmTiaRVs7dYKcbEnu Mi9oSQj1n71+Bq3FJUApjyCY7tVR/XJpJckAs19ENcnulrLcRNAD65sf5eNKXbdQAt/0 /6wcHXPcbaQb0Dzm7hsY20R96Z4qdfNu8quoAaD/3ttcbI+/qDmZFgGEjc9YBStmC0+0 up1A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u18si3830087ejk.105.2019.10.04.17.36.18; Fri, 04 Oct 2019 17:36:42 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731474AbfJEAdZ (ORCPT + 99 others); Fri, 4 Oct 2019 20:33:25 -0400 Received: from mga06.intel.com ([134.134.136.31]:34432 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730400AbfJEAdY (ORCPT ); Fri, 4 Oct 2019 20:33:24 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Oct 2019 17:33:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,258,1566889200"; d="scan'208";a="191743043" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga008.fm.intel.com with ESMTP; 04 Oct 2019 17:33:22 -0700 From: Wei Yang To: mike.kravetz@oracle.com, akpm@linux-foundation.org, hughd@google.com, aarcange@redhat.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wei Yang Subject: [PATCH] hugetlb: remove unused hstate in hugetlb_fault_mutex_hash() Date: Sat, 5 Oct 2019 08:33:02 +0800 Message-Id: <20191005003302.785-1-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190927151033.aad57472652a0b3a6948df6e@linux-foundation.org> References: <20190927151033.aad57472652a0b3a6948df6e@linux-foundation.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The first parameter hstate in function hugetlb_fault_mutex_hash() is not used anymore. This patch removes it. Signed-off-by: Wei Yang Suggested-by: Andrew Morton --- fs/hugetlbfs/inode.c | 4 ++-- include/linux/hugetlb.h | 4 ++-- mm/hugetlb.c | 12 ++++++------ mm/userfaultfd.c | 5 +---- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index a478df035651..715db1e34174 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -440,7 +440,7 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart, u32 hash; index = page->index; - hash = hugetlb_fault_mutex_hash(h, mapping, index, 0); + hash = hugetlb_fault_mutex_hash(mapping, index, 0); mutex_lock(&hugetlb_fault_mutex_table[hash]); /* @@ -644,7 +644,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, addr = index * hpage_size; /* mutex taken here, fault path and hole punch */ - hash = hugetlb_fault_mutex_hash(h, mapping, index, addr); + hash = hugetlb_fault_mutex_hash(mapping, index, addr); mutex_lock(&hugetlb_fault_mutex_table[hash]); /* See if already present in mapping to avoid alloc/free */ diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 53fc34f930d0..40e9e3fad1cf 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -105,8 +105,8 @@ void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason); void free_huge_page(struct page *page); void hugetlb_fix_reserve_counts(struct inode *inode); extern struct mutex *hugetlb_fault_mutex_table; -u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping, - pgoff_t idx, unsigned long address); +u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx, + unsigned long address); pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud); diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ef37c85423a5..e0f033baac9d 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3916,7 +3916,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * handling userfault. Reacquire after handling * fault to make calling code simpler. */ - hash = hugetlb_fault_mutex_hash(h, mapping, idx, haddr); + hash = hugetlb_fault_mutex_hash(mapping, idx, haddr); mutex_unlock(&hugetlb_fault_mutex_table[hash]); ret = handle_userfault(&vmf, VM_UFFD_MISSING); mutex_lock(&hugetlb_fault_mutex_table[hash]); @@ -4043,8 +4043,8 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, } #ifdef CONFIG_SMP -u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping, - pgoff_t idx, unsigned long address) +u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx, + unsigned long address) { unsigned long key[2]; u32 hash; @@ -4061,8 +4061,8 @@ u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping, * For uniprocesor systems we always use a single mutex, so just * return 0 and avoid the hashing overhead. */ -u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping, - pgoff_t idx, unsigned long address) +u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx, + unsigned long address) { return 0; } @@ -4106,7 +4106,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, * get spurious allocation failures if two CPUs race to instantiate * the same page in the page cache. */ - hash = hugetlb_fault_mutex_hash(h, mapping, idx, haddr); + hash = hugetlb_fault_mutex_hash(mapping, idx, haddr); mutex_lock(&hugetlb_fault_mutex_table[hash]); entry = huge_ptep_get(ptep); diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c index 0a40746a5b1e..5c0a80626cf0 100644 --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -214,7 +214,6 @@ static __always_inline ssize_t __mcopy_atomic_hugetlb(struct mm_struct *dst_mm, unsigned long src_addr, dst_addr; long copied; struct page *page; - struct hstate *h; unsigned long vma_hpagesize; pgoff_t idx; u32 hash; @@ -271,8 +270,6 @@ static __always_inline ssize_t __mcopy_atomic_hugetlb(struct mm_struct *dst_mm, goto out_unlock; } - h = hstate_vma(dst_vma); - while (src_addr < src_start + len) { pte_t dst_pteval; @@ -283,7 +280,7 @@ static __always_inline ssize_t __mcopy_atomic_hugetlb(struct mm_struct *dst_mm, */ idx = linear_page_index(dst_vma, dst_addr); mapping = dst_vma->vm_file->f_mapping; - hash = hugetlb_fault_mutex_hash(h, mapping, idx, dst_addr); + hash = hugetlb_fault_mutex_hash(mapping, idx, dst_addr); mutex_lock(&hugetlb_fault_mutex_table[hash]); err = -ENOMEM; -- 2.17.1