]> rtime.felk.cvut.cz Git - zynq/linux.git/blobdiff - mm/workingset.c
Apply preempt_rt patch-4.9-rt1.patch.xz
[zynq/linux.git] / mm / workingset.c
index fb1f9183d89a360d7b7851a9083e098ff5696b8c..7e6ef1a48cd3cc7ab4c1a29a303917b859ec4a2f 100644 (file)
@@ -334,7 +334,8 @@ out:
  * point where they would still be useful.
  */
 
-struct list_lru workingset_shadow_nodes;
+struct list_lru __workingset_shadow_nodes;
+DEFINE_LOCAL_IRQ_LOCK(workingset_shadow_lock);
 
 static unsigned long count_shadow_nodes(struct shrinker *shrinker,
                                        struct shrink_control *sc)
@@ -344,9 +345,9 @@ static unsigned long count_shadow_nodes(struct shrinker *shrinker,
        unsigned long pages;
 
        /* list_lru lock nests inside IRQ-safe mapping->tree_lock */
-       local_irq_disable();
-       shadow_nodes = list_lru_shrink_count(&workingset_shadow_nodes, sc);
-       local_irq_enable();
+       local_lock_irq(workingset_shadow_lock);
+       shadow_nodes = list_lru_shrink_count(&__workingset_shadow_nodes, sc);
+       local_unlock_irq(workingset_shadow_lock);
 
        if (sc->memcg) {
                pages = mem_cgroup_node_nr_lru_pages(sc->memcg, sc->nid,
@@ -438,9 +439,9 @@ static enum lru_status shadow_lru_isolate(struct list_head *item,
        spin_unlock(&mapping->tree_lock);
        ret = LRU_REMOVED_RETRY;
 out:
-       local_irq_enable();
+       local_unlock_irq(workingset_shadow_lock);
        cond_resched();
-       local_irq_disable();
+       local_lock_irq(workingset_shadow_lock);
        spin_lock(lru_lock);
        return ret;
 }
@@ -451,10 +452,10 @@ static unsigned long scan_shadow_nodes(struct shrinker *shrinker,
        unsigned long ret;
 
        /* list_lru lock nests inside IRQ-safe mapping->tree_lock */
-       local_irq_disable();
-       ret =  list_lru_shrink_walk(&workingset_shadow_nodes, sc,
+       local_lock_irq(workingset_shadow_lock);
+       ret =  list_lru_shrink_walk(&__workingset_shadow_nodes, sc,
                                    shadow_lru_isolate, NULL);
-       local_irq_enable();
+       local_unlock_irq(workingset_shadow_lock);
        return ret;
 }
 
@@ -492,7 +493,7 @@ static int __init workingset_init(void)
        pr_info("workingset: timestamp_bits=%d max_order=%d bucket_order=%u\n",
               timestamp_bits, max_order, bucket_order);
 
-       ret = list_lru_init_key(&workingset_shadow_nodes, &shadow_nodes_key);
+       ret = list_lru_init_key(&__workingset_shadow_nodes, &shadow_nodes_key);
        if (ret)
                goto err;
        ret = register_shrinker(&workingset_shadow_shrinker);
@@ -500,7 +501,7 @@ static int __init workingset_init(void)
                goto err_list_lru;
        return 0;
 err_list_lru:
-       list_lru_destroy(&workingset_shadow_nodes);
+       list_lru_destroy(&__workingset_shadow_nodes);
 err:
        return ret;
 }