All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arch/x86/kernel/process.c: avoid unnecessary NULL check in get_wchan
@ 2018-11-21 11:12 Yafang Shao
  2018-11-22 10:15 ` [tip:x86/cleanups] x86/process: Avoid unnecessary NULL check in get_wchan() tip-bot for Yafang Shao
  2018-11-23  7:03 ` tip-bot for Yafang Shao
  0 siblings, 2 replies; 3+ messages in thread
From: Yafang Shao @ 2018-11-21 11:12 UTC (permalink / raw)
  To: tglx, mingo, bp, hpa; +Cc: x86, linux-kernel, Yafang Shao

Because the task p is always guaranteed to be non-NULL.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
 arch/x86/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index c93fcfd..3c3ee89 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -730,7 +730,7 @@ unsigned long get_wchan(struct task_struct *p)
 	unsigned long start, bottom, top, sp, fp, ip, ret = 0;
 	int count = 0;
 
-	if (!p || p == current || p->state == TASK_RUNNING)
+	if (p == current || p->state == TASK_RUNNING)
 		return 0;
 
 	if (!try_get_task_stack(p))
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [tip:x86/cleanups] x86/process: Avoid unnecessary NULL check in get_wchan()
  2018-11-21 11:12 [PATCH] arch/x86/kernel/process.c: avoid unnecessary NULL check in get_wchan Yafang Shao
@ 2018-11-22 10:15 ` tip-bot for Yafang Shao
  2018-11-23  7:03 ` tip-bot for Yafang Shao
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Yafang Shao @ 2018-11-22 10:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, linux-kernel, dvlasenk, peterz, brgerst, luto, hpa, mingo,
	laoar.shao, torvalds, bp

Commit-ID:  c382986fe178d02abdfcd6f4e7b9783c2922872c
Gitweb:     https://git.kernel.org/tip/c382986fe178d02abdfcd6f4e7b9783c2922872c
Author:     Yafang Shao <laoar.shao@gmail.com>
AuthorDate: Wed, 21 Nov 2018 19:12:14 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 22 Nov 2018 10:07:21 +0100

x86/process: Avoid unnecessary NULL check in get_wchan()

Task 'p' is always guaranteed to be non-NULL, because the only call
sites are in fs/proc/ which all guarantee a non-NULL task pointer.

[ mingo: Improved the changelog. ]
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1542798734-12532-1-git-send-email-laoar.shao@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 8a33d4ad9661..b7cb5348f37f 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -733,7 +733,7 @@ unsigned long get_wchan(struct task_struct *p)
 	unsigned long start, bottom, top, sp, fp, ip, ret = 0;
 	int count = 0;
 
-	if (!p || p == current || p->state == TASK_RUNNING)
+	if (p == current || p->state == TASK_RUNNING)
 		return 0;
 
 	if (!try_get_task_stack(p))

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [tip:x86/cleanups] x86/process: Avoid unnecessary NULL check in get_wchan()
  2018-11-21 11:12 [PATCH] arch/x86/kernel/process.c: avoid unnecessary NULL check in get_wchan Yafang Shao
  2018-11-22 10:15 ` [tip:x86/cleanups] x86/process: Avoid unnecessary NULL check in get_wchan() tip-bot for Yafang Shao
@ 2018-11-23  7:03 ` tip-bot for Yafang Shao
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Yafang Shao @ 2018-11-23  7:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: laoar.shao, brgerst, peterz, mingo, dvlasenk, linux-kernel, bp,
	torvalds, luto, tglx, hpa

Commit-ID:  6e662ae7bce6db602f79e57791f5fb887fb7d371
Gitweb:     https://git.kernel.org/tip/6e662ae7bce6db602f79e57791f5fb887fb7d371
Author:     Yafang Shao <laoar.shao@gmail.com>
AuthorDate: Wed, 21 Nov 2018 19:12:14 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 23 Nov 2018 07:58:23 +0100

x86/process: Avoid unnecessary NULL check in get_wchan()

Task 'p' is always guaranteed to be non-NULL, because the only call
sites are in fs/proc/ which all guarantee a non-NULL task pointer.

[ mingo: Improved the changelog. ]
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1542798734-12532-1-git-send-email-laoar.shao@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index c93fcfdf1673..3c3ee8982577 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -730,7 +730,7 @@ unsigned long get_wchan(struct task_struct *p)
 	unsigned long start, bottom, top, sp, fp, ip, ret = 0;
 	int count = 0;
 
-	if (!p || p == current || p->state == TASK_RUNNING)
+	if (p == current || p->state == TASK_RUNNING)
 		return 0;
 
 	if (!try_get_task_stack(p))

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-23  7:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21 11:12 [PATCH] arch/x86/kernel/process.c: avoid unnecessary NULL check in get_wchan Yafang Shao
2018-11-22 10:15 ` [tip:x86/cleanups] x86/process: Avoid unnecessary NULL check in get_wchan() tip-bot for Yafang Shao
2018-11-23  7:03 ` tip-bot for Yafang Shao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.