[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141113180433.GK4460@linux.vnet.ibm.com>
Date: Thu, 13 Nov 2014 10:04:34 -0800
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Aaron Tomlin <atomlin@...hat.com>,
Alexey Dobriyan <adobriyan@...il.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Sterling Alexander <stalexan@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] proc: task_state: move the main seq_printf() outside
of rcu_read_lock()
On Fri, Nov 07, 2014 at 09:14:51PM +0100, Oleg Nesterov wrote:
> task_state() does seq_printf() under rcu_read_lock(), but this is only
> needed for task_tgid_nr_ns() and task_numa_group_id(). We can calculate
> tgid/ngid and drop rcu lock.
>
> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
Reviewed-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
> ---
> fs/proc/array.c | 12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/fs/proc/array.c b/fs/proc/array.c
> index 7c8d9ae..800e30f 100644
> --- a/fs/proc/array.c
> +++ b/fs/proc/array.c
> @@ -158,7 +158,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
> struct group_info *group_info;
> int g;
> const struct cred *cred;
> - pid_t ppid, tpid;
> + pid_t ppid, tpid, tgid, ngid;
> unsigned int max_fds = 0;
>
> rcu_read_lock();
> @@ -170,12 +170,16 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
> if (tracer)
> tpid = task_pid_nr_ns(tracer, ns);
> }
> +
> + tgid = task_tgid_nr_ns(p, ns);
> + ngid = task_numa_group_id(p);
> cred = get_task_cred(p);
>
> task_lock(p);
> if (p->files)
> max_fds = files_fdtable(p->files)->max_fds;
> task_unlock(p);
> + rcu_read_unlock();
>
> seq_printf(m,
> "State:\t%s\n"
> @@ -188,10 +192,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
> "Gid:\t%d\t%d\t%d\t%d\n"
> "FDSize:\t%d\nGroups:\t",
> get_task_state(p),
> - task_tgid_nr_ns(p, ns),
> - task_numa_group_id(p),
> - pid_nr_ns(pid, ns),
> - ppid, tpid,
> + tgid, ngid, pid_nr_ns(pid, ns), ppid, tpid,
> from_kuid_munged(user_ns, cred->uid),
> from_kuid_munged(user_ns, cred->euid),
> from_kuid_munged(user_ns, cred->suid),
> @@ -201,7 +202,6 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
> from_kgid_munged(user_ns, cred->sgid),
> from_kgid_munged(user_ns, cred->fsgid),
> max_fds);
> - rcu_read_unlock();
>
> group_info = cred->group_info;
> for (g = 0; g < group_info->ngroups; g++)
> --
> 1.5.5.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists