static void __split_huge_page_refcount(struct page *page)
{
int i;
- unsigned long head_index = page->index;
struct zone *zone = page_zone(page);
int zonestat;
int tail_count = 0;
/* complete memcg works before add pages to LRU */
mem_cgroup_split_huge_fixup(page);
- for (i = 1; i < HPAGE_PMD_NR; i++) {
+ for (i = HPAGE_PMD_NR - 1; i >= 1; i--) {
struct page *page_tail = page + i;
/* tail_page->_mapcount cannot change */
BUG_ON(page_tail->mapping);
page_tail->mapping = page->mapping;
- page_tail->index = ++head_index;
+ page_tail->index = page->index + i;
BUG_ON(!PageAnon(page_tail));
BUG_ON(!PageUptodate(page_tail));
if (likely(PageLRU(page)))
list_add(&page_tail->lru, page->lru.prev);
else
- list_add(&page_tail->lru, &lruvec->lists[lru]);
+ list_add(&page_tail->lru, lruvec->lists[lru].prev);
__mod_zone_page_state(zone, NR_LRU_BASE + lru,
hpage_nr_pages(page_tail));
} else {