Merge tag 'x86_cache_for_v5.10' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / mm / page_io.c
index 454b70d..4ca28aa 100644 (file)
@@ -85,7 +85,7 @@ static void swap_slot_free_notify(struct page *page)
                return;
 
        sis = page_swap_info(page);
-       if (!(sis->flags & SWP_BLKDEV))
+       if (data_race(!(sis->flags & SWP_BLKDEV)))
                return;
 
        /*
@@ -252,6 +252,16 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
                unlock_page(page);
                goto out;
        }
+       /*
+        * Arch code may have to preserve more data than just the page
+        * contents, e.g. memory tags.
+        */
+       ret = arch_prepare_to_swap(page);
+       if (ret) {
+               set_page_dirty(page);
+               unlock_page(page);
+               goto out;
+       }
        if (frontswap_store(page) == 0) {
                set_page_writeback(page);
                unlock_page(page);
@@ -302,7 +312,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
        struct swap_info_struct *sis = page_swap_info(page);
 
        VM_BUG_ON_PAGE(!PageSwapCache(page), page);
-       if (sis->flags & SWP_FS) {
+       if (data_race(sis->flags & SWP_FS)) {
                struct kiocb kiocb;
                struct file *swap_file = sis->swap_file;
                struct address_space *mapping = swap_file->f_mapping;
@@ -393,7 +403,7 @@ int swap_readpage(struct page *page, bool synchronous)
                goto out;
        }
 
-       if (sis->flags & SWP_FS) {
+       if (data_race(sis->flags & SWP_FS)) {
                struct file *swap_file = sis->swap_file;
                struct address_space *mapping = swap_file->f_mapping;
 
@@ -455,7 +465,7 @@ int swap_set_page_dirty(struct page *page)
 {
        struct swap_info_struct *sis = page_swap_info(page);
 
-       if (sis->flags & SWP_FS) {
+       if (data_race(sis->flags & SWP_FS)) {
                struct address_space *mapping = sis->swap_file->f_mapping;
 
                VM_BUG_ON_PAGE(!PageSwapCache(page), page);