From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Hocko Subject: Re: [patch v2] mm: memcontrol: do not iterate uninitialized memcgs Date: Thu, 25 Sep 2014 16:11:48 +0200 Message-ID: <20140925141148.GD11080@dhcp22.suse.cz> References: <1411612278-4707-1-git-send-email-hannes@cmpxchg.org> <20140925024054.GA4888@cmpxchg.org> <20140925114339.GD12090@dhcp22.suse.cz> <20140925135450.GA1822@cmpxchg.org> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=T2OQReUH6VfDyisiDInUE6BnaoNgfNjLdjMqgZaIKgo=; b=inUfTKTaS/aZxviwbmDww7FIEO1y6VGUBKskcZbPMd2ZWOlH/7QlNhHI/1JupqfK7R akOv8Rc0S3Lu2PvdILrMoKhm616F2+LidySrleBPl84vTuU513xd0XcC5pjz6OUcNSg4 2uSIcQO1mBsBzxvvcTzDZ4+bvKXizPuhGw7SAPOTgfIdWL84w2iNequXwscxwy4aU15L Yy9gR9chRI2YxDBpvn4YFyKuIASGWJAFbZwRlWBrHWi/NkDwPSn8sfqsDZkYFINtdWUV bPCi4Kuz88Td5moO2R8YC5JayoP/rObA9bO6kcfkV5nNk1afg0RqWfUHRK9Ayq+yFshB Nu/A== Content-Disposition: inline In-Reply-To: <20140925135450.GA1822-druUgvl0LCNAfugRpC6u6w@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Johannes Weiner Cc: Andrew Morton , Hugh Dickins , Tejun Heo , linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Thu 25-09-14 09:54:50, Johannes Weiner wrote: > On Thu, Sep 25, 2014 at 01:43:39PM +0200, Michal Hocko wrote: > > On Wed 24-09-14 22:40:55, Johannes Weiner wrote: > > > Argh, buggy css_put() against the root. Hand grenades, everywhere. > > > Update: > > > > > > --- > > > From 9b0b4d72d71cd8acd7aaa58d2006c751decc8739 Mon Sep 17 00:00:00 2001 > > > From: Johannes Weiner > > > Date: Wed, 24 Sep 2014 22:00:20 -0400 > > > Subject: [patch] mm: memcontrol: do not iterate uninitialized memcgs > > > > > > The cgroup iterators yield css objects that have not yet gone through > > > css_online(), but they are not complete memcgs at this point and so > > > the memcg iterators should not return them. d8ad30559715 ("mm/memcg: > > > iteration skip memcgs not yet fully initialized") set out to implement > > > exactly this, but it uses CSS_ONLINE, a cgroup-internal flag that does > > > not meet the ordering requirements for memcg, and so we still may see > > > partially initialized memcgs from the iterators. > > > > I do not see how would this happen. CSS_ONLINE is set after css_online > > callback returns and mem_cgroup_css_online ends the core initialization > > with mutex_unlock which should provide sufficient memory ordering > > requirements > > But the iterators do not use the mutex? We are missing the matching > acquire for the proper ordering. OK, I guess you are right. Besides that I am not sure what are the ordering guarantees of mutex now that I am looking into the code. Anyway it is definitely better to be explicit about barriers. -- Michal Hocko SUSE Labs