]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - mm/vmpressure.c
serial: icom: move array overflow checks earlier
[karo-tx-linux.git] / mm / vmpressure.c
index f4ee6a190a4dee86ce8d008ad2a9d166adf992ec..0c1e37d829fa026a9fc61ef93b569087939867c5 100644 (file)
@@ -246,7 +246,7 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg,
        scanned = vmpr->scanned;
        spin_unlock(&vmpr->sr_lock);
 
-       if (scanned < vmpressure_win || work_pending(&vmpr->work))
+       if (scanned < vmpressure_win)
                return;
        schedule_work(&vmpr->work);
 }
@@ -372,3 +372,19 @@ void vmpressure_init(struct vmpressure *vmpr)
        INIT_LIST_HEAD(&vmpr->events);
        INIT_WORK(&vmpr->work, vmpressure_work_fn);
 }
+
+/**
+ * vmpressure_cleanup() - shuts down vmpressure control structure
+ * @vmpr:      Structure to be cleaned up
+ *
+ * This function should be called before the structure in which it is
+ * embedded is cleaned up.
+ */
+void vmpressure_cleanup(struct vmpressure *vmpr)
+{
+       /*
+        * Make sure there is no pending work before eventfd infrastructure
+        * goes away.
+        */
+       flush_work(&vmpr->work);
+}