Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2641622pxj; Mon, 31 May 2021 07:12:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3GXzqm9nqkFdvBBAPVooGWH9QbBwXRVKPP10G37cAYfzpLq6o4SdZO5Wl8xmScVAKAhfv X-Received: by 2002:a05:6e02:92a:: with SMTP id o10mr17476770ilt.270.1622470355385; Mon, 31 May 2021 07:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622470355; cv=none; d=google.com; s=arc-20160816; b=B2+Sr1IZRwmtc4+y2LjShRhEtOYyxpp9OQ/Yqs6VtUIK28aS89wgJ6QkgYyIbSqk4/ Tmii6Izf9nG+OHW2V6b/3rGP2VZqge60SKnUBJSB1iCRL/t2H9FJ+iPJrgLzMpW+7irB foVFQE2AKd93KK07tcDER+q1Nucxy+C9KPnq9TiHZR9vtWGN6PdYZ+krUl14wqSrMxnh cXxmDTnaLvVIrdXzX3mFpV6FGukd1GQwivmuQIDYhLRQT+J/684OsHtbBt5BFcyCtT3E /lT/cxc2rfdFigyUTP7QoqMIRFexFc1SMd+CogQBQgtbHqxee4Hey1bhqeN1bHYt2Mwj bnZA== 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=12/P15Egw6zbUr49FlZ5k5kRMNVd1H792y524zEfk+A=; b=khxpZAxvpXTntGzLmqzgZigMcs8THuSmAAkk2lMexRdJhJ3i36ox1YhoJbP8sHt9mR Ti8XWgsNmSJZGP6X3h4J6BOINWnRXBONLS1+w+7IbTqBJX3jeDfD50P5jdl5kRzbDlU1 PPNq9d4Qq85zHmtZAvyS2wU8rW4MoB2zgisYGkwAFaCP4mzAMSFSMKWqKxaRiOxjQjP+ mrkQ+0/RLfj/6YXiAnZ55j5iff4dvKHiPRElwFrALN1guC9ckJGW/rKOvAaLP2nY7FNK laBU/HZqU2mbQAI7rB/0O9h7kmOWti8/2XRtH4HNFtLnQpqfWH+nc2NXLIc3qXqhlTEK dqVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nLcujQKu; 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 c15si4085718jam.64.2021.05.31.07.12.21; Mon, 31 May 2021 07:12:35 -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=nLcujQKu; 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 S233411AbhEaOMt (ORCPT + 99 others); Mon, 31 May 2021 10:12:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:50196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232856AbhEaNpn (ORCPT ); Mon, 31 May 2021 09:45:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBFC56142B; Mon, 31 May 2021 13:29:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467797; bh=0rp0hbiB+Kp09uOC7vDu7Mo1v4hoq6zkxNkJXxDq77U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nLcujQKuAMn9KTUUXCadW0Mlia+Zs9/L4K4H2VVHcRPZDu/alc94CIXOLlu4ia3mT 3BVgesU+PcAKPMM5m1Ku+0TN/8GNBroN+cccSlHD9k1jwjdV3zXKVAxJAS3fugEd+/ uYWW1YrvAQ5hSPl8N6ihE5WWTWidh9BrXltOQzUw= 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.14 77/79] hugetlbfs: hugetlb_fault_mutex_hash() cleanup Date: Mon, 31 May 2021 15:15:02 +0200 Message-Id: <20210531130638.466476865@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130636.002722319@linuxfoundation.org> References: <20210531130636.002722319@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 | 11 +++++------ mm/userfaultfd.c | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -436,7 +436,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]); /* @@ -618,7 +618,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 @@ -123,7 +123,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 @@ -3802,8 +3802,7 @@ retry: * handling userfault. Reacquire after handling * fault to make calling code simpler. */ - hash = hugetlb_fault_mutex_hash(h, mapping, idx, - address); + 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]); @@ -3916,7 +3915,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; @@ -3924,7 +3923,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); } @@ -3934,7 +3933,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; } @@ -3979,7 +3978,7 @@ int hugetlb_fault(struct mm_struct *mm, * 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, address); + 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 @@ -272,7 +272,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;