From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754550AbcEBQe7 (ORCPT ); Mon, 2 May 2016 12:34:59 -0400 Received: from mail-yw0-f176.google.com ([209.85.161.176]:36812 "EHLO mail-yw0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754149AbcEBQet (ORCPT ); Mon, 2 May 2016 12:34:49 -0400 Date: Mon, 2 May 2016 12:34:41 -0400 From: Tejun Heo To: serge.hallyn@ubuntu.com Cc: linux-kernel@vger.kernel.org, adityakali@google.com, linux-api@vger.kernel.org, containers@lists.linux-foundation.org, cgroups@vger.kernel.org, akpm@linux-foundation.org, ebiederm@xmission.com, gregkh@linuxfoundation.org, lizefan@huawei.com, hannes@cmpxchg.org Subject: Re: [PATCH 2/2] mountinfo: implement show_path for kernfs and cgroup Message-ID: <20160502163441.GV7822@mtj.duckdns.org> References: <1460923472-29370-1-git-send-email-serge.hallyn@ubuntu.com> <1460923472-29370-3-git-send-email-serge.hallyn@ubuntu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1460923472-29370-3-git-send-email-serge.hallyn@ubuntu.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Sun, Apr 17, 2016 at 03:04:32PM -0500, serge.hallyn@ubuntu.com wrote: > +static int cgroup_show_path(struct seq_file *sf, struct kernfs_node *kf_node, > + struct kernfs_root *kf_root) > +{ > + int len = 0, ret = 0; > + char *buf = NULL; > + struct cgroup_namespace *ns = current->nsproxy->cgroup_ns; > + struct cgroup_root *kf_cgroot = cgroup_root_from_kf(kf_root); > + struct cgroup *ns_cgroup; > + > + mutex_lock(&cgroup_mutex); > + spin_lock_bh(&css_set_lock); > + ns_cgroup = cset_cgroup_from_root(ns->root_cset, kf_cgroot); > + len = kernfs_path_from_node(kf_node, ns_cgroup->kn, NULL, 0); > + if (len > 0) > + buf = kmalloc(len + 1, GFP_ATOMIC); Ugh... What's up with GFP_ATOMIC? Just allocate maximum sized buffer before grabbing any locks. Thanks. -- tejun