mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + proc-get-rid-of-task-lock-unlock-pair-to-read-umask-for-the-status-file.patch added to -mm tree
@ 2018-02-08 20:28 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2018-02-08 20:28 UTC (permalink / raw)
  To: mguzik, adobriyan, jmarchan, koct9i, mm-commits


The patch titled
     Subject: proc: get rid of task lock/unlock pair to read umask for the "status" file
has been added to the -mm tree.  Its filename is
     proc-get-rid-of-task-lock-unlock-pair-to-read-umask-for-the-status-file.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/proc-get-rid-of-task-lock-unlock-pair-to-read-umask-for-the-status-file.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/proc-get-rid-of-task-lock-unlock-pair-to-read-umask-for-the-status-file.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Mateusz Guzik <mguzik@redhat.com>
Subject: proc: get rid of task lock/unlock pair to read umask for the "status" file

get_task_umask locks/unlocks the task on its own.  The only caller does
the same thing immediately after.

Utilize the fact the task has to be locked anyway and just do it once. 
Since there are no other users and the code is short, fold it in.

Link: http://lkml.kernel.org/r/1517995608-23683-1-git-send-email-mguzik@redhat.com
Signed-off-by: Mateusz Guzik <mguzik@redhat.com>
Reviewed-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/proc/array.c |   23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff -puN fs/proc/array.c~proc-get-rid-of-task-lock-unlock-pair-to-read-umask-for-the-status-file fs/proc/array.c
--- a/fs/proc/array.c~proc-get-rid-of-task-lock-unlock-pair-to-read-umask-for-the-status-file
+++ a/fs/proc/array.c
@@ -141,25 +141,12 @@ static inline const char *get_task_state
 	return task_state_array[task_state_index(tsk)];
 }
 
-static inline int get_task_umask(struct task_struct *tsk)
-{
-	struct fs_struct *fs;
-	int umask = -ENOENT;
-
-	task_lock(tsk);
-	fs = tsk->fs;
-	if (fs)
-		umask = fs->umask;
-	task_unlock(tsk);
-	return umask;
-}
-
 static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
 				struct pid *pid, struct task_struct *p)
 {
 	struct user_namespace *user_ns = seq_user_ns(m);
 	struct group_info *group_info;
-	int g, umask;
+	int g, umask = -1;
 	struct task_struct *tracer;
 	const struct cred *cred;
 	pid_t ppid, tpid = 0, tgid, ngid;
@@ -177,16 +164,16 @@ static inline void task_state(struct seq
 	ngid = task_numa_group_id(p);
 	cred = get_task_cred(p);
 
-	umask = get_task_umask(p);
-	if (umask >= 0)
-		seq_printf(m, "Umask:\t%#04o\n", umask);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-02-08 20:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-08 20:28 + proc-get-rid-of-task-lock-unlock-pair-to-read-umask-for-the-status-file.patch added to -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).