From: Greg Kroah-Hartman Date: Mon, 31 May 2021 06:57:03 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v4.4.271~38 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4e13325a05f55a1fa060b1ad3e9c24c3b24050a4;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: hugetlbfs-hugetlb_fault_mutex_hash-cleanup.patch --- diff --git a/queue-4.19/hugetlbfs-hugetlb_fault_mutex_hash-cleanup.patch b/queue-4.19/hugetlbfs-hugetlb_fault_mutex_hash-cleanup.patch new file mode 100644 index 00000000000..cce0f6f320c --- /dev/null +++ b/queue-4.19/hugetlbfs-hugetlb_fault_mutex_hash-cleanup.patch @@ -0,0 +1,127 @@ +From 552546366a30d88bd1d6f5efe848b2ab50fd57e5 Mon Sep 17 00:00:00 2001 +From: Mike Kravetz +Date: Sat, 30 Nov 2019 17:56:30 -0800 +Subject: hugetlbfs: hugetlb_fault_mutex_hash() cleanup + +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; diff --git a/queue-4.19/series b/queue-4.19/series index c36b0dea48b..a8b18434ed1 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -112,3 +112,4 @@ ipv6-record-frag_max_size-in-atomic-fragments-in-inp.patch sch_dsmark-fix-a-null-deref-in-qdisc_reset.patch mips-alchemy-xxs1500-add-gpio-au1000.h-header-file.patch mips-ralink-export-rt_sysc_membase-for-rt2880_wdt.c.patch +hugetlbfs-hugetlb_fault_mutex_hash-cleanup.patch