From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751442Ab3IIJAa (ORCPT ); Mon, 9 Sep 2013 05:00:30 -0400 Received: from mail-pb0-f48.google.com ([209.85.160.48]:47082 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751368Ab3IIJA2 (ORCPT ); Mon, 9 Sep 2013 05:00:28 -0400 Date: Mon, 9 Sep 2013 02:00:26 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Michal Hocko cc: Andrew Morton , KAMEZAWA Hiroyuki , Johannes Weiner , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [patch] mm, memcg: store memcg name for oom kill log consistency In-Reply-To: <20130905135219.GE13666@dhcp22.suse.cz> Message-ID: References: <20130829133032.GB12077@dhcp22.suse.cz> <20130905135219.GE13666@dhcp22.suse.cz> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 5 Sep 2013, Michal Hocko wrote: > From 4cee36f56100f5689fe1ae22f468016ce5a0cbae Mon Sep 17 00:00:00 2001 > From: Michal Hocko > Date: Thu, 5 Sep 2013 15:39:20 +0200 > Subject: [PATCH] memcg, oom: lock mem_cgroup_print_oom_info > > mem_cgroup_print_oom_info uses a static buffer (memcg_name) to store the > name of the cgroup. This is not safe as pointed out by David Rientjes > because although memcg oom is locked for its hierarchy nothing prevents > another parallel hierarchy to trigger oom as well and overwrite the > already in-use buffer. > > This patch introduces oom_info_lock hidden inside mem_cgroup_print_oom_info > which is held throughout the function. It make access to memcg_name safe > and as a bonus it also prevents parallel memcg ooms to interleave their > statistics which would make the printed data hard to analyze otherwise. > > Using the spinlock is OK here because this path is not hot and > meaningful data is much more important. > > Reported-by: David Rientjes Remove this. > Signed-off-by: Michal Hocko