]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.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)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 1 Dec 2019 20:59:08 +0000 (12:59 -0800)
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>
fs/hugetlbfs/inode.c
include/linux/hugetlb.h
mm/hugetlb.c
mm/userfaultfd.c

index a478df03565179d1aa07c8db52c04a72421241f5..6e5eadee6b0d1cb872f9e84e892ad1690576a481 100644 (file)
@@ -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(h, mapping, index);
                        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(h, mapping, index);
                mutex_lock(&hugetlb_fault_mutex_table[hash]);
 
                /* See if already present in mapping to avoid alloc/free */
index 53fc34f930d08cd8edcfb95834e882d713de49fe..d3814bd686ba181f5f3807ca8cf5af124cee7c8d 100644 (file)
@@ -106,7 +106,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);
 
index 26b722faf740a438e83b2ad8efee5e7a1c444793..39579f98d6f3ca3e1e93918195b0f271d31ffe55 100644 (file)
@@ -3842,7 +3842,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]);
@@ -3970,7 +3970,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;
@@ -3978,7 +3978,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);
 }
@@ -3988,7 +3988,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;
 }
@@ -4032,7 +4032,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(h, mapping, idx);
        mutex_lock(&hugetlb_fault_mutex_table[hash]);
 
        entry = huge_ptep_get(ptep);
index c7ae74ce5ff3e6f2d01824e0dbcad08d856eb9ff..640ff2bd9a6930df331d4d0a55403ab7fb3967df 100644 (file)
@@ -269,7 +269,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;