From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933565Ab3GWQSh (ORCPT ); Tue, 23 Jul 2013 12:18:37 -0400 Received: from mail-gg0-f180.google.com ([209.85.161.180]:46865 "EHLO mail-gg0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933104Ab3GWQSg (ORCPT ); Tue, 23 Jul 2013 12:18:36 -0400 Date: Tue, 23 Jul 2013 12:18:25 -0400 From: Tejun Heo To: Michal Hocko Cc: Andrew Morton , Anton Vorontsov , Johannes Weiner , KAMEZAWA Hiroyuki , KOSAKI Motohiro , Li Zefan , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH resend 3/3] vmpressure: Make sure there are no events queued after memcg is offlined Message-ID: <20130723161825.GC21100@mtj.dyndns.org> References: <1374252671-11939-1-git-send-email-mhocko@suse.cz> <1374252671-11939-3-git-send-email-mhocko@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1374252671-11939-3-git-send-email-mhocko@suse.cz> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 19, 2013 at 06:51:11PM +0200, Michal Hocko wrote: > vmpressure is called synchronously from the reclaim where the > target_memcg is guaranteed to be alive but the eventfd is signaled from > the work queue context. This means that memcg (along with vmpressure > structure which is embedded into it) might go away while the work item > is pending which would result in use-after-release bug. > > We have two possible ways how to fix this. Either vmpressure pins memcg > before it schedules vmpr->work and unpin it in vmpressure_work_fn or > explicitely flush the work item from the css_offline context (as > suggested by Tejun). > > This patch implements the later one and it introduces vmpressure_cleanup > which flushes the vmpressure work queue item item. It hooks into > mem_cgroup_css_offline after the memcg itself is cleaned up. > > Reported-by: Tejun Heo > Signed-off-by: Michal Hocko Acked-by: Tejun Heo Thanks! -- tejun