> @@ -178,7 +179,7 @@ static void vmpressure_work_fn(struct work_struct *work) > * vmpr->reclaimed is in sync. > */ > if (!vmpr->scanned) > - return; > + goto out; > > mutex_lock(&vmpr->sr_lock); > scanned = vmpr->scanned; > @@ -195,6 +196,13 @@ static void vmpressure_work_fn(struct work_struct *work) > * hierarchy. > */ > } while ((vmpr = vmpressure_parent(vmpr))); > +out: > + /* > + * Reference has been taken in vmpressure. > + * memcg which embeds this vmpr might go away after this call so > + * no further manipulation with vmprs or work item is safe > + */ > + vmpressure_unpin_memcg(vmpr); > } > > /** > @@ -248,6 +256,9 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, > > if (scanned < vmpressure_win || work_pending(&vmpr->work)) > return; > + > + /* Reference will be released in vmpressure_work_fn */ > + vmpressure_pin_memcg(vmpr); > schedule_work(&vmpr->work); Looks like a work can be queued right after the above work_pending() returns 0, then we should do this: if (schedule_work(&vmpr->work)) vmpressure_pin_memcg(vmpr); > } > -- To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html