Merge tag 'leds-next-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
[platform/kernel/linux-starfive.git] / mm / fadvise.c
index fb7c5f4..6c39d42 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/mm.h>
 #include <linux/pagemap.h>
 #include <linux/backing-dev.h>
-#include <linux/pagevec.h>
 #include <linux/fadvise.h>
 #include <linux/writeback.h>
 #include <linux/syscalls.h>
@@ -143,7 +142,7 @@ int generic_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
                }
 
                if (end_index >= start_index) {
-                       unsigned long nr_pagevec = 0;
+                       unsigned long nr_failed = 0;
 
                        /*
                         * It's common to FADV_DONTNEED right after
@@ -156,17 +155,15 @@ int generic_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
                         */
                        lru_add_drain();
 
-                       invalidate_mapping_pagevec(mapping,
-                                               start_index, end_index,
-                                               &nr_pagevec);
+                       mapping_try_invalidate(mapping, start_index, end_index,
+                                       &nr_failed);
 
                        /*
-                        * If fewer pages were invalidated than expected then
-                        * it is possible that some of the pages were on
-                        * a per-cpu pagevec for a remote CPU. Drain all
-                        * pagevecs and try again.
+                        * The failures may be due to the folio being
+                        * in the LRU cache of a remote CPU. Drain all
+                        * caches and try again.
                         */
-                       if (nr_pagevec) {
+                       if (nr_failed) {
                                lru_add_drain_all();
                                invalidate_mapping_pages(mapping, start_index,
                                                end_index);