]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
hugetlbfs: hugetlb_fault_mutex_hash() cleanup
authorMike Kravetz <mike.kravetz@oracle.com>
Sun, 1 Dec 2019 01:56:30 +0000 (17:56 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Jun 2021 06:22:09 +0000 (08:22 +0200)
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 <mike.kravetz@oracle.com>
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Davidlohr Bueso <dbueso@suse.de>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Ilie Halip <ilie.halip@gmail.com>
Cc: David Bolvansky <david.bolvansky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/hugetlbfs/inode.c
include/linux/hugetlb.h
mm/hugetlb.c

index b743aa5bce0d2704adc395ac5d6803e2a5a358d6..1d5e3b0a3b1a27f8530dd3ae34d9ceece58b28d9 100644 (file)
@@ -414,7 +414,7 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
                        if (next >= end)
                                break;
 
-                       hash = hugetlb_fault_mutex_hash(h, mapping, next, 0);
+                       hash = hugetlb_fault_mutex_hash(h, mapping, next);
                        mutex_lock(&hugetlb_fault_mutex_table[hash]);
 
                        lock_page(page);
@@ -630,7 +630,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(h, mapping, index);
                mutex_lock(&hugetlb_fault_mutex_table[hash]);
 
                /* See if already present in mapping to avoid alloc/free */
index c4a4a39a458dcaeef832c97e2561fc19d1c9e7e8..b39733d7e27c24302d8593c43a16dee57fb8e231 100644 (file)
@@ -92,7 +92,7 @@ void free_huge_page(struct page *page);
 void hugetlb_fix_reserve_counts(struct inode *inode, bool restore_reserve);
 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);
 
 #ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
 pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
index e933cae307bf9aebc0108d73f2b934a948654995..86a5c9852acfd6886b6e83dcd6adb20c8d6ead44 100644 (file)
@@ -3771,7 +3771,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;
@@ -3779,7 +3779,7 @@ u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping,
        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);
 }
@@ -3789,7 +3789,7 @@ u32 hugetlb_fault_mutex_hash(struct hstate *h, struct address_space *mapping,
  * 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;
 }
@@ -3834,7 +3834,7 @@ int 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, address);
+       hash = hugetlb_fault_mutex_hash(h, mapping, idx);
        mutex_lock(&hugetlb_fault_mutex_table[hash]);
 
        entry = huge_ptep_get(ptep);