Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1392374

Re: [PATCH 2/2] mountinfo: implement show_path for kernfs and cgroup

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] mountinfo: implement show_path for kernfs and cgroup
Date 2016-05-02 18:40 +0200
Message-ID <rup36-6RX-37@gated-at.bofh.it> (permalink)
References <rp1b3-1ts-3@gated-at.bofh.it> <rp1b3-1ts-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 2/2] mountinfo: implement show_path for kernfs and cgroup Tejun Heo <tj@kernel.org> - 2016-05-02 18:40 +0200

csiph-web