]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm: remove redundant check about FAULT_FLAG_ALLOW_RETRY bit
authorQi Zheng <zhengqi.arch@bytedance.com>
Fri, 14 Jan 2022 22:05:51 +0000 (14:05 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 15 Jan 2022 14:30:27 +0000 (16:30 +0200)
Since commit 85fa6c186149 ("mm: allow VM_FAULT_RETRY for multiple
times") allowed VM_FAULT_RETRY for multiple times, the
FAULT_FLAG_ALLOW_RETRY bit of fault_flag will not be changed in the page
fault path, so the following check is no longer needed:

flags & FAULT_FLAG_ALLOW_RETRY

So just remove it.

[akpm@linux-foundation.org: coding style fixes]

Link: https://lkml.kernel.org/r/20211110123358.36511-1-zhengqi.arch@bytedance.com
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Kirill Shutemov <kirill@shutemov.name>
Cc: Peter Xu <peterx@redhat.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
22 files changed:
arch/alpha/mm/fault.c
arch/arc/mm/fault.c
arch/arm/mm/fault.c
arch/arm64/mm/fault.c
arch/hexagon/mm/vm_fault.c
arch/ia64/mm/fault.c
arch/m68k/mm/fault.c
arch/microblaze/mm/fault.c
arch/mips/mm/fault.c
arch/nds32/mm/fault.c
arch/nios2/mm/fault.c
arch/openrisc/mm/fault.c
arch/parisc/mm/fault.c
arch/powerpc/mm/fault.c
arch/riscv/mm/fault.c
arch/s390/mm/fault.c
arch/sh/mm/fault.c
arch/sparc/mm/fault_32.c
arch/sparc/mm/fault_64.c
arch/um/kernel/trap.c
arch/x86/mm/fault.c
arch/xtensa/mm/fault.c

index eee5102c3d8897200545314e88cc664e3e33d1ac..6c0a277388ddaf7c0aec825ca1ed3e5f4c4cc76b 100644 (file)
@@ -165,17 +165,15 @@ retry:
                BUG();
        }
 
-       if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               if (fault & VM_FAULT_RETRY) {
-                       flags |= FAULT_FLAG_TRIED;
+       if (fault & VM_FAULT_RETRY) {
+               flags |= FAULT_FLAG_TRIED;
 
-                        /* No need to mmap_read_unlock(mm) as we would
-                        * have already released it in __lock_page_or_retry
-                        * in mm/filemap.c.
-                        */
+               /* No need to mmap_read_unlock(mm) as we would
+                * have already released it in __lock_page_or_retry
+                * in mm/filemap.c.
+                */
 
-                       goto retry;
-               }
+               goto retry;
        }
 
        mmap_read_unlock(mm);
index 5787c261c9a4e260fab8bcb73410922bc0e118d5..dad27e4d69ff1af6d68313a982802aa101808613 100644 (file)
@@ -149,8 +149,7 @@ retry:
        /*
         * Fault retry nuances, mmap_lock already relinquished by core mm
         */
-       if (unlikely((fault & VM_FAULT_RETRY) &&
-                    (flags & FAULT_FLAG_ALLOW_RETRY))) {
+       if (unlikely(fault & VM_FAULT_RETRY)) {
                flags |= FAULT_FLAG_TRIED;
                goto retry;
        }
index bc8779d54a64051d4648de6c60ff053d9652226d..c7326a521a6983a8daeaf047caf29a3c75e6914e 100644 (file)
@@ -312,7 +312,7 @@ retry:
                return 0;
        }
 
-       if (!(fault & VM_FAULT_ERROR) && flags & FAULT_FLAG_ALLOW_RETRY) {
+       if (!(fault & VM_FAULT_ERROR)) {
                if (fault & VM_FAULT_RETRY) {
                        flags |= FAULT_FLAG_TRIED;
                        goto retry;
index 9ae24e3b72be119792c13f36df8a8e83b505f5e7..a8fb54fccde05bbd18d42052703cf4b217402957 100644 (file)
@@ -606,10 +606,8 @@ retry:
        }
 
        if (fault & VM_FAULT_RETRY) {
-               if (mm_flags & FAULT_FLAG_ALLOW_RETRY) {
-                       mm_flags |= FAULT_FLAG_TRIED;
-                       goto retry;
-               }
+               mm_flags |= FAULT_FLAG_TRIED;
+               goto retry;
        }
        mmap_read_unlock(mm);
 
index ef32c5a84ff3bf0b256b6016b1127e9db46c1457..4fac4b9eb3164f20444e19305aa32abf35d6773a 100644 (file)
@@ -98,11 +98,9 @@ good_area:
 
        /* The most common case -- we are done. */
        if (likely(!(fault & VM_FAULT_ERROR))) {
-               if (flags & FAULT_FLAG_ALLOW_RETRY) {
-                       if (fault & VM_FAULT_RETRY) {
-                               flags |= FAULT_FLAG_TRIED;
-                               goto retry;
-                       }
+               if (fault & VM_FAULT_RETRY) {
+                       flags |= FAULT_FLAG_TRIED;
+                       goto retry;
                }
 
                mmap_read_unlock(mm);
index 02de2e70c5874dfd50fba2cc50437d9c2ad82da0..32417f49ad2fe0038cab004f2c82d735744143ac 100644 (file)
@@ -156,17 +156,15 @@ retry:
                BUG();
        }
 
-       if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               if (fault & VM_FAULT_RETRY) {
-                       flags |= FAULT_FLAG_TRIED;
+       if (fault & VM_FAULT_RETRY) {
+               flags |= FAULT_FLAG_TRIED;
 
-                        /* No need to mmap_read_unlock(mm) as we would
-                        * have already released it in __lock_page_or_retry
-                        * in mm/filemap.c.
-                        */
+               /* No need to mmap_read_unlock(mm) as we would
+                * have already released it in __lock_page_or_retry
+                * in mm/filemap.c.
+                */
 
-                       goto retry;
-               }
+               goto retry;
        }
 
        mmap_read_unlock(mm);
index ef46e77e97a5b35ad0315691af456ca90f1870fb..53cfb9bc1066ff61931477cf2558671dd64b5dc0 100644 (file)
@@ -153,18 +153,16 @@ good_area:
                BUG();
        }
 
-       if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               if (fault & VM_FAULT_RETRY) {
-                       flags |= FAULT_FLAG_TRIED;
-
-                       /*
-                        * No need to mmap_read_unlock(mm) as we would
-                        * have already released it in __lock_page_or_retry
-                        * in mm/filemap.c.
-                        */
-
-                       goto retry;
-               }
+       if (fault & VM_FAULT_RETRY) {
+               flags |= FAULT_FLAG_TRIED;
+
+               /*
+                * No need to mmap_read_unlock(mm) as we would
+                * have already released it in __lock_page_or_retry
+                * in mm/filemap.c.
+                */
+
+               goto retry;
        }
 
        mmap_read_unlock(mm);
index b3fed2cecf84be2c36f5c43ad0715b9c1cc3f126..a9626e6a68af93f34962129870c5d5c91cee40a0 100644 (file)
@@ -232,18 +232,16 @@ good_area:
                BUG();
        }
 
-       if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               if (fault & VM_FAULT_RETRY) {
-                       flags |= FAULT_FLAG_TRIED;
-
-                       /*
-                        * No need to mmap_read_unlock(mm) as we would
-                        * have already released it in __lock_page_or_retry
-                        * in mm/filemap.c.
-                        */
-
-                       goto retry;
-               }
+       if (fault & VM_FAULT_RETRY) {
+               flags |= FAULT_FLAG_TRIED;
+
+               /*
+                * No need to mmap_read_unlock(mm) as we would
+                * have already released it in __lock_page_or_retry
+                * in mm/filemap.c.
+                */
+
+               goto retry;
        }
 
        mmap_read_unlock(mm);
index e7abda9c013f27d405071badf22868aa3a1e25e6..44f98100e84e3ae8ae3b755b6c4cc42fc784ea97 100644 (file)
@@ -171,18 +171,17 @@ good_area:
                        goto do_sigbus;
                BUG();
        }
-       if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               if (fault & VM_FAULT_RETRY) {
-                       flags |= FAULT_FLAG_TRIED;
 
-                       /*
-                        * No need to mmap_read_unlock(mm) as we would
-                        * have already released it in __lock_page_or_retry
-                        * in mm/filemap.c.
-                        */
+       if (fault & VM_FAULT_RETRY) {
+               flags |= FAULT_FLAG_TRIED;
 
-                       goto retry;
-               }
+               /*
+                * No need to mmap_read_unlock(mm) as we would
+                * have already released it in __lock_page_or_retry
+                * in mm/filemap.c.
+                */
+
+               goto retry;
        }
 
        mmap_read_unlock(mm);
index 1d139b11716877a5001b53dcf063221e7ed8074b..636977a1c8b901751136daf9035eae84c0101113 100644 (file)
@@ -230,16 +230,14 @@ good_area:
                        goto bad_area;
        }
 
-       if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               if (fault & VM_FAULT_RETRY) {
-                       flags |= FAULT_FLAG_TRIED;
-
-                       /* No need to mmap_read_unlock(mm) as we would
-                        * have already released it in __lock_page_or_retry
-                        * in mm/filemap.c.
-                        */
-                       goto retry;
-               }
+       if (fault & VM_FAULT_RETRY) {
+               flags |= FAULT_FLAG_TRIED;
+
+               /* No need to mmap_read_unlock(mm) as we would
+                * have already released it in __lock_page_or_retry
+                * in mm/filemap.c.
+                */
+               goto retry;
        }
 
        mmap_read_unlock(mm);
index 9476feecf512f93642e7ded47b97ec30ffb56318..a32f14cd72f2891b5d7856fee5b98f8283a08cae 100644 (file)
@@ -149,18 +149,16 @@ good_area:
                BUG();
        }
 
-       if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               if (fault & VM_FAULT_RETRY) {
-                       flags |= FAULT_FLAG_TRIED;
+       if (fault & VM_FAULT_RETRY) {
+               flags |= FAULT_FLAG_TRIED;
 
-                       /*
-                        * No need to mmap_read_unlock(mm) as we would
-                        * have already released it in __lock_page_or_retry
-                        * in mm/filemap.c.
-                        */
+               /*
+                * No need to mmap_read_unlock(mm) as we would
+                * have already released it in __lock_page_or_retry
+                * in mm/filemap.c.
+                */
 
-                       goto retry;
-               }
+               goto retry;
        }
 
        mmap_read_unlock(mm);
index f0fa6394a58ec52f089c31970724f3630740bc2e..80bb66ad42f6fa48527df6555ac64fb4b968739f 100644 (file)
@@ -177,18 +177,16 @@ good_area:
                BUG();
        }
 
-       if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               /*RGD modeled on Cris */
-               if (fault & VM_FAULT_RETRY) {
-                       flags |= FAULT_FLAG_TRIED;
+       /*RGD modeled on Cris */
+       if (fault & VM_FAULT_RETRY) {
+               flags |= FAULT_FLAG_TRIED;
 
-                        /* No need to mmap_read_unlock(mm) as we would
-                        * have already released it in __lock_page_or_retry
-                        * in mm/filemap.c.
-                        */
+               /* No need to mmap_read_unlock(mm) as we would
+                * have already released it in __lock_page_or_retry
+                * in mm/filemap.c.
+                */
 
-                       goto retry;
-               }
+               goto retry;
        }
 
        mmap_read_unlock(mm);
index 4a6221b869fd2249de7dc1e03330c9f601d56a02..360b627645cca6e2c837b76256d7a09f6e453004 100644 (file)
@@ -324,16 +324,14 @@ good_area:
                        goto bad_area;
                BUG();
        }
-       if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               if (fault & VM_FAULT_RETRY) {
-                       /*
-                        * No need to mmap_read_unlock(mm) as we would
-                        * have already released it in __lock_page_or_retry
-                        * in mm/filemap.c.
-                        */
-                       flags |= FAULT_FLAG_TRIED;
-                       goto retry;
-               }
+       if (fault & VM_FAULT_RETRY) {
+               /*
+                * No need to mmap_read_unlock(mm) as we would
+                * have already released it in __lock_page_or_retry
+                * in mm/filemap.c.
+                */
+               flags |= FAULT_FLAG_TRIED;
+               goto retry;
        }
        mmap_read_unlock(mm);
        return;
index a8d0ce85d39ad44a8a82253ca9648a4fe38cf268..ebcc61e47d62ba6a8bbb0834d6aed662ac14f2dc 100644 (file)
@@ -516,10 +516,8 @@ retry:
         * case.
         */
        if (unlikely(fault & VM_FAULT_RETRY)) {
-               if (flags & FAULT_FLAG_ALLOW_RETRY) {
-                       flags |= FAULT_FLAG_TRIED;
-                       goto retry;
-               }
+               flags |= FAULT_FLAG_TRIED;
+               goto retry;
        }
 
        mmap_read_unlock(current->mm);
index aa08dd2f8faec2625500fe6f5a40afd36cfe65d3..cae4b6363607136a7b9dc9c95632e4524144e2d3 100644 (file)
@@ -330,7 +330,7 @@ good_area:
        if (fault_signal_pending(fault, regs))
                return;
 
-       if (unlikely((fault & VM_FAULT_RETRY) && (flags & FAULT_FLAG_ALLOW_RETRY))) {
+       if (unlikely(fault & VM_FAULT_RETRY)) {
                flags |= FAULT_FLAG_TRIED;
 
                /*
index d30f5986fa8567ccabef68391984f9c2899086f2..d7d6be283d9425779eec60c8561308de1252a720 100644 (file)
@@ -452,21 +452,21 @@ retry:
        if (unlikely(fault & VM_FAULT_ERROR))
                goto out_up;
 
-       if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               if (fault & VM_FAULT_RETRY) {
-                       if (IS_ENABLED(CONFIG_PGSTE) && gmap &&
-                           (flags & FAULT_FLAG_RETRY_NOWAIT)) {
-                               /* FAULT_FLAG_RETRY_NOWAIT has been set,
-                                * mmap_lock has not been released */
-                               current->thread.gmap_pfault = 1;
-                               fault = VM_FAULT_PFAULT;
-                               goto out_up;
-                       }
-                       flags &= ~FAULT_FLAG_RETRY_NOWAIT;
-                       flags |= FAULT_FLAG_TRIED;
-                       mmap_read_lock(mm);
-                       goto retry;
+       if (fault & VM_FAULT_RETRY) {
+               if (IS_ENABLED(CONFIG_PGSTE) && gmap &&
+                       (flags & FAULT_FLAG_RETRY_NOWAIT)) {
+                       /*
+                        * FAULT_FLAG_RETRY_NOWAIT has been set, mmap_lock has
+                        * not been released
+                        */
+                       current->thread.gmap_pfault = 1;
+                       fault = VM_FAULT_PFAULT;
+                       goto out_up;
                }
+               flags &= ~FAULT_FLAG_RETRY_NOWAIT;
+               flags |= FAULT_FLAG_TRIED;
+               mmap_read_lock(mm);
+               goto retry;
        }
        if (IS_ENABLED(CONFIG_PGSTE) && gmap) {
                address =  __gmap_link(gmap, current->thread.gmap_addr,
index 1e1aa75df3cad101f63af0fef064daa9313cafe0..e175667b13637907d2b4825237d800a20c5d5f18 100644 (file)
@@ -485,17 +485,15 @@ good_area:
                if (mm_fault_error(regs, error_code, address, fault))
                        return;
 
-       if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               if (fault & VM_FAULT_RETRY) {
-                       flags |= FAULT_FLAG_TRIED;
-
-                       /*
-                        * No need to mmap_read_unlock(mm) as we would
-                        * have already released it in __lock_page_or_retry
-                        * in mm/filemap.c.
-                        */
-                       goto retry;
-               }
+       if (fault & VM_FAULT_RETRY) {
+               flags |= FAULT_FLAG_TRIED;
+
+               /*
+                * No need to mmap_read_unlock(mm) as we would
+                * have already released it in __lock_page_or_retry
+                * in mm/filemap.c.
+                */
+               goto retry;
        }
 
        mmap_read_unlock(mm);
index 90dc4ae315c897289bf4cc3a7a02a5be60f7bd76..ad569d9bd1242cde74ea530aafffb48cd95d72db 100644 (file)
@@ -200,17 +200,15 @@ good_area:
                BUG();
        }
 
-       if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               if (fault & VM_FAULT_RETRY) {
-                       flags |= FAULT_FLAG_TRIED;
+       if (fault & VM_FAULT_RETRY) {
+               flags |= FAULT_FLAG_TRIED;
 
-                       /* No need to mmap_read_unlock(mm) as we would
-                        * have already released it in __lock_page_or_retry
-                        * in mm/filemap.c.
-                        */
+               /* No need to mmap_read_unlock(mm) as we would
+                * have already released it in __lock_page_or_retry
+                * in mm/filemap.c.
+                */
 
-                       goto retry;
-               }
+               goto retry;
        }
 
        mmap_read_unlock(mm);
index 9a9652a15fed1de2b716200fc8272b2e134ef62e..253e07043298b73a1fd5d99119f05a3eeec160af 100644 (file)
@@ -437,17 +437,15 @@ good_area:
                BUG();
        }
 
-       if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               if (fault & VM_FAULT_RETRY) {
-                       flags |= FAULT_FLAG_TRIED;
+       if (fault & VM_FAULT_RETRY) {
+               flags |= FAULT_FLAG_TRIED;
 
-                       /* No need to mmap_read_unlock(mm) as we would
-                        * have already released it in __lock_page_or_retry
-                        * in mm/filemap.c.
-                        */
+               /* No need to mmap_read_unlock(mm) as we would
+                * have already released it in __lock_page_or_retry
+                * in mm/filemap.c.
+                */
 
-                       goto retry;
-               }
+               goto retry;
        }
        mmap_read_unlock(mm);
 
index c32efb09db2142cd3a53a481a18c4276f33b196b..193503484af57dbbf1143ce5de0b07ff7cb41c4b 100644 (file)
@@ -87,12 +87,10 @@ good_area:
                        }
                        BUG();
                }
-               if (flags & FAULT_FLAG_ALLOW_RETRY) {
-                       if (fault & VM_FAULT_RETRY) {
-                               flags |= FAULT_FLAG_TRIED;
+               if (fault & VM_FAULT_RETRY) {
+                       flags |= FAULT_FLAG_TRIED;
 
-                               goto retry;
-                       }
+                       goto retry;
                }
 
                pmd = pmd_off(mm, address);
index 4bfed53e210ec287d8cea9b774f2f045fce2be38..d0074c6ed31a38ba1778bc776f857a6088b943d3 100644 (file)
@@ -1413,8 +1413,7 @@ good_area:
         * and if there is a fatal signal pending there is no guarantee
         * that we made any progress. Handle this case first.
         */
-       if (unlikely((fault & VM_FAULT_RETRY) &&
-                    (flags & FAULT_FLAG_ALLOW_RETRY))) {
+       if (unlikely(fault & VM_FAULT_RETRY)) {
                flags |= FAULT_FLAG_TRIED;
                goto retry;
        }
index fd6a706359625868aa12ccc838b906b2dbf682e2..06d0973a0d7472e4b7777231fa775b17a2ac9200 100644 (file)
@@ -127,17 +127,16 @@ good_area:
                        goto do_sigbus;
                BUG();
        }
-       if (flags & FAULT_FLAG_ALLOW_RETRY) {
-               if (fault & VM_FAULT_RETRY) {
-                       flags |= FAULT_FLAG_TRIED;
 
-                        /* No need to mmap_read_unlock(mm) as we would
-                        * have already released it in __lock_page_or_retry
-                        * in mm/filemap.c.
-                        */
+       if (fault & VM_FAULT_RETRY) {
+               flags |= FAULT_FLAG_TRIED;
 
-                       goto retry;
-               }
+               /* No need to mmap_read_unlock(mm) as we would
+                * have already released it in __lock_page_or_retry
+                * in mm/filemap.c.
+                */
+
+               goto retry;
        }
 
        mmap_read_unlock(mm);