huge_memory.c (94723aafb9e76414fada7c1c198733a86f01ea8f) huge_memory.c (b93b016313b3ba8003c3b8bb71f569af91f19fc7)
1/*
2 * Copyright (C) 2009 Red Hat, Inc.
3 *
4 * This work is licensed under the terms of the GNU GPL, version 2. See
5 * the COPYING file in the top-level directory.
6 */
7
8#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

--- 2436 unchanged lines hidden (view full) ---

2445 /* Additional pin to radix tree of swap cache */
2446 if (PageSwapCache(head))
2447 page_ref_add(head, 2);
2448 else
2449 page_ref_inc(head);
2450 } else {
2451 /* Additional pin to radix tree */
2452 page_ref_add(head, 2);
1/*
2 * Copyright (C) 2009 Red Hat, Inc.
3 *
4 * This work is licensed under the terms of the GNU GPL, version 2. See
5 * the COPYING file in the top-level directory.
6 */
7
8#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

--- 2436 unchanged lines hidden (view full) ---

2445 /* Additional pin to radix tree of swap cache */
2446 if (PageSwapCache(head))
2447 page_ref_add(head, 2);
2448 else
2449 page_ref_inc(head);
2450 } else {
2451 /* Additional pin to radix tree */
2452 page_ref_add(head, 2);
2453 spin_unlock(&head->mapping->tree_lock);
2453 xa_unlock(&head->mapping->i_pages);
2454 }
2455
2456 spin_unlock_irqrestore(zone_lru_lock(page_zone(head)), flags);
2457
2458 unfreeze_page(head);
2459
2460 for (i = 0; i < HPAGE_PMD_NR; i++) {
2461 struct page *subpage = head + i;

--- 191 unchanged lines hidden (view full) ---

2653 lru_add_drain();
2654
2655 /* prevent PageLRU to go away from under us, and freeze lru stats */
2656 spin_lock_irqsave(zone_lru_lock(page_zone(head)), flags);
2657
2658 if (mapping) {
2659 void **pslot;
2660
2454 }
2455
2456 spin_unlock_irqrestore(zone_lru_lock(page_zone(head)), flags);
2457
2458 unfreeze_page(head);
2459
2460 for (i = 0; i < HPAGE_PMD_NR; i++) {
2461 struct page *subpage = head + i;

--- 191 unchanged lines hidden (view full) ---

2653 lru_add_drain();
2654
2655 /* prevent PageLRU to go away from under us, and freeze lru stats */
2656 spin_lock_irqsave(zone_lru_lock(page_zone(head)), flags);
2657
2658 if (mapping) {
2659 void **pslot;
2660
2661 spin_lock(&mapping->tree_lock);
2662 pslot = radix_tree_lookup_slot(&mapping->page_tree,
2661 xa_lock(&mapping->i_pages);
2662 pslot = radix_tree_lookup_slot(&mapping->i_pages,
2663 page_index(head));
2664 /*
2665 * Check if the head page is present in radix tree.
2666 * We assume all tail are present too, if head is there.
2667 */
2668 if (radix_tree_deref_slot_protected(pslot,
2663 page_index(head));
2664 /*
2665 * Check if the head page is present in radix tree.
2666 * We assume all tail are present too, if head is there.
2667 */
2668 if (radix_tree_deref_slot_protected(pslot,
2669 &mapping->tree_lock) != head)
2669 &mapping->i_pages.xa_lock) != head)
2670 goto fail;
2671 }
2672
2673 /* Prevent deferred_split_scan() touching ->_refcount */
2674 spin_lock(&pgdata->split_queue_lock);
2675 count = page_count(head);
2676 mapcount = total_mapcount(head);
2677 if (!mapcount && page_ref_freeze(head, 1 + extra_pins)) {

--- 17 unchanged lines hidden (view full) ---

2695 mapcount, count);
2696 if (PageTail(page))
2697 dump_page(head, NULL);
2698 dump_page(page, "total_mapcount(head) > 0");
2699 BUG();
2700 }
2701 spin_unlock(&pgdata->split_queue_lock);
2702fail: if (mapping)
2670 goto fail;
2671 }
2672
2673 /* Prevent deferred_split_scan() touching ->_refcount */
2674 spin_lock(&pgdata->split_queue_lock);
2675 count = page_count(head);
2676 mapcount = total_mapcount(head);
2677 if (!mapcount && page_ref_freeze(head, 1 + extra_pins)) {

--- 17 unchanged lines hidden (view full) ---

2695 mapcount, count);
2696 if (PageTail(page))
2697 dump_page(head, NULL);
2698 dump_page(page, "total_mapcount(head) > 0");
2699 BUG();
2700 }
2701 spin_unlock(&pgdata->split_queue_lock);
2702fail: if (mapping)
2703 spin_unlock(&mapping->tree_lock);
2703 xa_unlock(&mapping->i_pages);
2704 spin_unlock_irqrestore(zone_lru_lock(page_zone(head)), flags);
2705 unfreeze_page(head);
2706 ret = -EBUSY;
2707 }
2708
2709out_unlock:
2710 if (anon_vma) {
2711 anon_vma_unlock_write(anon_vma);

--- 223 unchanged lines hidden ---
2704 spin_unlock_irqrestore(zone_lru_lock(page_zone(head)), flags);
2705 unfreeze_page(head);
2706 ret = -EBUSY;
2707 }
2708
2709out_unlock:
2710 if (anon_vma) {
2711 anon_vma_unlock_write(anon_vma);

--- 223 unchanged lines hidden ---