Skip to contentSkip to conversation

sched: Add a PF flag for ksoftirqd identification

PATCH New stable-bot for Venkatesh Pallipadi 1 participant 1 message Feb 10, 2011 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 16/28 sched: Add a PF flag for ksoftirqd identification

Commit: 6cdd5199daf0cb7b0fcc8dca941af08492612887 upstream
Author: Venkatesh Pallipadi <[email protected]>
AuthorDate: Mon Oct 4 17:03:18 2010 -0700

To account softirq time cleanly in scheduler, we need to identify whether softirq is invoked in ksoftirqd context or softirq at hardirq tail context. Add PF_KSOFTIRQD for that purpose.

As all PF flag bits are currently taken, create space by moving one of the infrequently used bits (PF_THREAD_BOUND) down in task_struct to be along with some other state fields.

LKML-Reference: <[email protected]>

---
 include/linux/sched.h |    1 +
 kernel/softirq.c      |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
include/linux/sched.h +1 -0
index 32bf471..63d5aea 100644
@@ -1728,6 +1728,7 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
 /*
  * Per process flags
  */
+#define PF_KSOFTIRQD	0x00000001	/* I am ksoftirqd */
 #define PF_STARTING	0x00000002	/* being created */
 #define PF_EXITING	0x00000004	/* getting shut down */
 #define PF_EXITPIDONE	0x00000008	/* pi exit done on shut down */
kernel/softirq.c +1 -0
index 0ed8343..0a617de 100644
@@ -718,6 +718,7 @@ static int ksoftirqd(void * __bind_cpu)
 {
 	set_current_state(TASK_INTERRUPTIBLE);
 
+	current->flags |= PF_KSOFTIRQD;
 	while (!kthread_should_stop()) {
 		preempt_disable();
 		if (!local_softirq_pending()) {
Signature · 1 line
1.7.4