Skip to contentSkip to conversation

fork.c: cleanup for copy_sighand()

PATCH In review Zhaolei 2 participants 2 messages Oct 31, 2008 – Nov 4, 2008

Subsystems (3)
lore
Share & tools
lore

Zhaolei

author
#0 lore raw

PATCH 1/1 fork.c: cleanup for copy_sighand()

Check CLONE_SIGHAND only is enough, because combination of CLONE_THREAD and CLONE_SIGHAND is already done in copy_process().

Impact: cleanup, no functionality changed

---
 kernel/fork.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/fork.c +1 -1
index f608356..36a0dac 100644
@@ -741,7 +741,7 @@ static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk)
 {
 	struct sighand_struct *sig;
 
-	if (clone_flags & (CLONE_SIGHAND | CLONE_THREAD)) {
+	if (clone_flags & CLONE_SIGHAND) {
 		atomic_inc(&current->sighand->count);
 		return 0;
 	}
Signature · 1 line
1.5.5.3
maintainer
#1 lore raw
Quoted 15 lines · On Fri, 31 Oct 2008 16:51:19 +0800 Zhaolei <[email protected]> wrote:

Check CLONE_SIGHAND only is enough, because combination of CLONE_THREAD and CLONE_SIGHAND is already done in copy_process().

Impact: cleanup, no functionality changed

---
 kernel/fork.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/fork.c +0 -0
index f608356..36a0dac 100644

kernel/fork.c static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk) · line 747

Quoted 8 lines
kernel/fork.c +1 -1
@@ -741,7 +741,7 @@ static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk)
 {
 	struct sighand_struct *sig;
 
-	if (clone_flags & (CLONE_SIGHAND | CLONE_THREAD)) {
+	if (clone_flags & CLONE_SIGHAND) {
 		atomic_inc(&current->sighand->count);
 		return 0;
 	}

OK, it appears to be correct and might yield a tiny speedup on some architectures.

But whether this change is desirable from a clarity and maintainability point of view is unclear to me. Let's add the cc's..