]> rtime.felk.cvut.cz Git - linux-imx.git/blobdiff - mm/vmpressure.c
vmpressure: make sure there are no events queued after memcg is offlined
[linux-imx.git] / mm / vmpressure.c
index 192f9731931da75b24b9a5f9b28203de9a0e2f85..0c1e37d829fa026a9fc61ef93b569087939867c5 100644 (file)
@@ -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);
+}