diff --git a/mm/vmpressure.c b/mm/vmpressure.c index 1a082a0..e16256e 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c @@ -164,6 +164,7 @@ static bool vmpressure_event(struct vmpressure *vmpr, } } + vmpr->notify_userspace = false; mutex_unlock(&vmpr->events_lock); return signalled; @@ -249,8 +250,13 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, mutex_lock(&vmpr->sr_lock); vmpr->scanned += scanned; vmpr->reclaimed += reclaimed; - vmpr->notify_userspace = true; scanned = vmpr->scanned; + /* + * If we didn't reach this point, only kernel events will be triggered. + * It is the job of the worker thread to clean this up once the + * notifications are all delivered. + */ + vmpr->notify_userspace = true; mutex_unlock(&vmpr->sr_lock); schedule: