Merge branch 'akpm' (patches from Andrew)
[linux-2.6-microblaze.git] / mm / khugepaged.c
index 7af84ba..35f14d0 100644 (file)
@@ -1664,7 +1664,10 @@ static void collapse_file(struct mm_struct *mm,
        }
        count_memcg_page_event(new_page, THP_COLLAPSE_ALLOC);
 
-       /* This will be less messy when we use multi-index entries */
+       /*
+        * Ensure we have slots for all the pages in the range.  This is
+        * almost certainly a no-op because most of the pages must be present
+        */
        do {
                xas_lock_irq(&xas);
                xas_create_range(&xas);
@@ -1889,6 +1892,9 @@ out_unlock:
                        __mod_lruvec_page_state(new_page, NR_SHMEM, nr_none);
        }
 
+       /* Join all the small entries into a single multi-index entry */
+       xas_set_order(&xas, start, HPAGE_PMD_ORDER);
+       xas_store(&xas, new_page);
 xa_locked:
        xas_unlock_irq(&xas);
 xa_unlocked:
@@ -2011,6 +2017,10 @@ static void khugepaged_scan_file(struct mm_struct *mm,
                        continue;
                }
 
+               /*
+                * XXX: khugepaged should compact smaller compound pages
+                * into a PMD sized page
+                */
                if (PageTransCompound(page)) {
                        result = SCAN_PAGE_COMPOUND;
                        break;