Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2628680pxj; Mon, 31 May 2021 06:57:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrNYOuS+5cCaCQGX89dHFgzaXetKiXGErPO0OdqR7exGe9NiM8pGxlvTqrTaY9Njmg3ySk X-Received: by 2002:a05:6e02:f93:: with SMTP id v19mr17237414ilo.126.1622469422899; Mon, 31 May 2021 06:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622469422; cv=none; d=google.com; s=arc-20160816; b=vHsvYhomrez+xY8rkjF6P2aepaIewBrwnlCXYU8Kib8qnExZTl0i9LnGErTAjl7PIt svn2mGDIfEsRfu5j6RYkdBuOlWnvAc2ltQ0srp9FFkU+2OW9Y69ubnjMbDHtdotBAhg9 gLmJspKODT+AVwn+wFT3jQbyqRbQmvBW4lRYFPhzUzhxCvRgvukkzFazRI8mNwZtqLnH 79BcCKCzt1fYLNYduXm+ojYax62DpF3Dw1zxuRAZLmeYvd4RhWhVPPKwDtZjG7NCglzf 2FyeWRC9umU+1ZY4cXEfSeOl2daiB8PbD/45N3o6dIgt74m/8sxQB/WVCy0NRL0UkOyp w0fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eLGTk5u+Vv7+W8FbJeAWuW2rszHd8M8EvRDFupWxL2I=; b=b/4NScSv9c9qggg09PdcM7rr+Yr4M8/aoJjf8uSOHAjbHLWwvipeHF2QcwnybaSCRD ugY3tO8js8KEWn0LFsXU6ePk/QMDnuO9AVD879A2EVlYybrwVUsxTztOqMjqdyTI02Q0 pvxgV3CoQD3/eFKeSU2pacrWm6X79gNwXz14mS1t3fVOOPZhsCl2tj3voUMgWde6n14J qz1XkU+F91ZeTuAXTBWvWvy0xAf44r+hSV8+3BuYaGfP4+TBmK1Iorvznpoyso51MwJR cJkuCnFPlVWDaauDW70LwZGKSJ3H2CcNNkGCPKTPG+Ysb4KwJKYrV6DZTBOrLNFz+d7C NWCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q5TNz13w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e25si12028378iol.49.2021.05.31.06.56.49; Mon, 31 May 2021 06:57:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q5TNz13w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232860AbhEaN5s (ORCPT + 99 others); Mon, 31 May 2021 09:57:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:44436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232625AbhEaNhy (ORCPT ); Mon, 31 May 2021 09:37:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 48C7661451; Mon, 31 May 2021 13:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467589; bh=RsEXmEfEr14BGaFRrRHL1C4y387lVxZ/Vzhb7fv5Ozk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q5TNz13wDCpOQm1duoPRe/CJIp9fhvhTeiHS4XLqYz45miaXgbBN61fjfUN6+DPKR Vm7D7dOvH0YedLiQCe23DULeKt+8ljqDlz/kEbM+tLqekhTNrI3OW4kNH7qR2mqraP hRIKh1Ax5Ad6PHxgjP7n2Io17qsICAg9tUpKgT0E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Kravetz , Nathan Chancellor , Davidlohr Bueso , Andrew Morton , Nick Desaulniers , Ilie Halip , David Bolvansky , Linus Torvalds Subject: [PATCH 4.19 113/116] hugetlbfs: hugetlb_fault_mutex_hash() cleanup Date: Mon, 31 May 2021 15:14:49 +0200 Message-Id: <20210531130643.945474436@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130640.131924542@linuxfoundation.org> References: <20210531130640.131924542@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Kravetz commit 552546366a30d88bd1d6f5efe848b2ab50fd57e5 upstream. A new clang diagnostic (-Wsizeof-array-div) warns about the calculation to determine the number of u32's in an array of unsigned longs. Suppress warning by adding parentheses. While looking at the above issue, noticed that the 'address' parameter to hugetlb_fault_mutex_hash is no longer used. So, remove it from the definition and all callers. No functional change. Link: http://lkml.kernel.org/r/20190919011847.18400-1-mike.kravetz@oracle.com Signed-off-by: Mike Kravetz Reported-by: Nathan Chancellor Reviewed-by: Nathan Chancellor Reviewed-by: Davidlohr Bueso Reviewed-by: Andrew Morton Cc: Nick Desaulniers Cc: Ilie Halip Cc: David Bolvansky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/hugetlbfs/inode.c | 4 ++-- include/linux/hugetlb.h | 2 +- mm/hugetlb.c | 10 +++++----- mm/userfaultfd.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -426,7 +426,7 @@ static void remove_inode_hugepages(struc u32 hash; index = page->index; - hash = hugetlb_fault_mutex_hash(h, mapping, index, 0); + hash = hugetlb_fault_mutex_hash(h, mapping, index); mutex_lock(&hugetlb_fault_mutex_table[hash]); /* @@ -623,7 +623,7 @@ static long hugetlbfs_fallocate(struct f 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(h, mapping, index); mutex_lock(&hugetlb_fault_mutex_table[hash]); /* See if already present in mapping to avoid alloc/free */ --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -124,7 +124,7 @@ 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); + pgoff_t idx); pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud); --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3862,7 +3862,7 @@ retry: * 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(h, mapping, idx); mutex_unlock(&hugetlb_fault_mutex_table[hash]); ret = handle_userfault(&vmf, VM_UFFD_MISSING); mutex_lock(&hugetlb_fault_mutex_table[hash]); @@ -3971,7 +3971,7 @@ backout_unlocked: #ifdef CONFIG_SMP u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping, - pgoff_t idx, unsigned long address) + pgoff_t idx) { unsigned long key[2]; u32 hash; @@ -3979,7 +3979,7 @@ u32 hugetlb_fault_mutex_hash(struct hsta key[0] = (unsigned long) mapping; key[1] = idx; - hash = jhash2((u32 *)&key, sizeof(key)/sizeof(u32), 0); + hash = jhash2((u32 *)&key, sizeof(key)/(sizeof(u32)), 0); return hash & (num_fault_mutexes - 1); } @@ -3989,7 +3989,7 @@ u32 hugetlb_fault_mutex_hash(struct hsta * 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) + pgoff_t idx) { return 0; } @@ -4033,7 +4033,7 @@ vm_fault_t hugetlb_fault(struct mm_struc * 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(h, mapping, idx); mutex_lock(&hugetlb_fault_mutex_table[hash]); entry = huge_ptep_get(ptep); --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -271,7 +271,7 @@ retry: */ 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(h, mapping, idx); mutex_lock(&hugetlb_fault_mutex_table[hash]); err = -ENOMEM;