Skip to contentSkip to conversation

unused task_struct.shared_unblocked variable.

PATCH New Oleg Nesterov 1 participant 1 message Sep 16, 2002 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 unused task_struct.shared_unblocked variable.

Hello.

The task_struct.shared_unblocked variable is unused.

The 'old_state' variable in try_to_wake_up() is unneeded.

The third recheck of rq->nr_running after load_balance() in schedule() is unneeded. Compiler should optimize it, but it looks slightly confusing (imho).

2.5.34 introduced this change in force_sig_info()

- return send_sig_info(sig, info, t);
+ return send_sig_info(sig, (void *)1, t);

I beleive, it is wrong, info can carry useful information from do_page_fault, traps. And this (info *)1 does not prevent send_signal() from allocation of siginfo struct. Ingo, could you please clarify?

Oleg.

include/linux/sched.h renamed from include/linux/sched.h.orig +1 -1
@@ -374,7 +374,7 @@
 	spinlock_t sigmask_lock;	/* Protects signal and blocked */
 	struct signal_struct *sig;
 
-	sigset_t blocked, real_blocked, shared_unblocked;
+	sigset_t blocked, real_blocked;
 	struct sigpending pending;
 
 	unsigned long sas_ss_sp;
kernel/sched.c renamed from kernel/sched.c.orig +7 -8
@@ -401,12 +401,10 @@
 {
 	unsigned long flags;
 	int success = 0;
-	long old_state;
 	runqueue_t *rq;
 
 repeat_lock_task:
 	rq = task_rq_lock(p, &flags);
-	old_state = p->state;
 	if (!p->array) {
 		/*
 		 * Fast-migrate the task if it's not running or runnable
@@ -420,7 +418,7 @@
 			task_rq_unlock(rq, &flags);
 			goto repeat_lock_task;
 		}
-		if (old_state == TASK_UNINTERRUPTIBLE)
+		if (p->state == TASK_UNINTERRUPTIBLE)
 			rq->nr_uninterruptible--;
 		activate_task(p, rq);
 
@@ -977,12 +975,13 @@
 	if (unlikely(!rq->nr_running)) {
 #if CONFIG_SMP
 		load_balance(rq, 1);
-		if (rq->nr_running)
-			goto pick_next_task;
+		if (!rq->nr_running)
 #endif
-		next = rq->idle;
-		rq->expired_timestamp = 0;
-		goto switch_tasks;
+		{
+			next = rq->idle;
+			rq->expired_timestamp = 0;
+			goto switch_tasks;
+		}
 	}
 
 	array = rq->active;
kernel/signal.c renamed from kernel/signal.c.orig +1 -1
@@ -783,7 +783,7 @@
 	recalc_sigpending_tsk(t);
 	spin_unlock_irqrestore(&t->sigmask_lock, flags);
 
-	return send_sig_info(sig, (void *)1, t);
+	return send_sig_info(sig, info, t);
 }
 
 static int