tizen: packaging: Add baselibs.conf to provide 64-bit kernel & modules for 32-bit...
[platform/kernel/linux-rpi.git] / mm / shmem.c
index 69595d3..e826be7 100644 (file)
@@ -1098,7 +1098,24 @@ whole_folios:
                                }
                                VM_BUG_ON_FOLIO(folio_test_writeback(folio),
                                                folio);
-                               truncate_inode_folio(mapping, folio);
+
+                               if (!folio_test_large(folio)) {
+                                       truncate_inode_folio(mapping, folio);
+                               } else if (truncate_inode_partial_folio(folio, lstart, lend)) {
+                                       /*
+                                        * If we split a page, reset the loop so
+                                        * that we pick up the new sub pages.
+                                        * Otherwise the THP was entirely
+                                        * dropped or the target range was
+                                        * zeroed, so just continue the loop as
+                                        * is.
+                                        */
+                                       if (!folio_test_large(folio)) {
+                                               folio_unlock(folio);
+                                               index = start;
+                                               break;
+                                       }
+                               }
                        }
                        folio_unlock(folio);
                }