
From: Matt Mackall <mpm@selenic.com>

The nswap and cnswap variables counters have never been incremented as
Linux doesn't do task swapping.


---

 25-akpm/arch/alpha/kernel/osf_sys.c |    3 ---
 25-akpm/fs/proc/array.c             |    4 ++--
 25-akpm/include/linux/sched.h       |    2 +-
 25-akpm/kernel/acct.c               |    2 +-
 25-akpm/kernel/exit.c               |    1 -
 25-akpm/kernel/fork.c               |    1 -
 25-akpm/kernel/sys.c                |    3 ---
 7 files changed, 4 insertions(+), 12 deletions(-)

diff -puN arch/alpha/kernel/osf_sys.c~remove-nswap-cnswap arch/alpha/kernel/osf_sys.c
--- 25/arch/alpha/kernel/osf_sys.c~remove-nswap-cnswap	2004-04-08 13:43:35.360105256 -0700
+++ 25-akpm/arch/alpha/kernel/osf_sys.c	2004-04-08 13:43:35.373103280 -0700
@@ -1095,14 +1095,12 @@ osf_getrusage(int who, struct rusage32 *
 		jiffies_to_timeval32(current->stime, &r.ru_stime);
 		r.ru_minflt = current->min_flt;
 		r.ru_majflt = current->maj_flt;
-		r.ru_nswap = current->nswap;
 		break;
 	case RUSAGE_CHILDREN:
 		jiffies_to_timeval32(current->cutime, &r.ru_utime);
 		jiffies_to_timeval32(current->cstime, &r.ru_stime);
 		r.ru_minflt = current->cmin_flt;
 		r.ru_majflt = current->cmaj_flt;
-		r.ru_nswap = current->cnswap;
 		break;
 	default:
 		jiffies_to_timeval32(current->utime + current->cutime,
@@ -1111,7 +1109,6 @@ osf_getrusage(int who, struct rusage32 *
 				   &r.ru_stime);
 		r.ru_minflt = current->min_flt + current->cmin_flt;
 		r.ru_majflt = current->maj_flt + current->cmaj_flt;
-		r.ru_nswap = current->nswap + current->cnswap;
 		break;
 	}
 
diff -puN fs/proc/array.c~remove-nswap-cnswap fs/proc/array.c
--- 25/fs/proc/array.c~remove-nswap-cnswap	2004-04-08 13:43:35.361105104 -0700
+++ 25-akpm/fs/proc/array.c	2004-04-08 13:43:35.373103280 -0700
@@ -392,8 +392,8 @@ int proc_pid_stat(struct task_struct *ta
 		sigign      .sig[0] & 0x7fffffffUL,
 		sigcatch    .sig[0] & 0x7fffffffUL,
 		wchan,
-		task->nswap,
-		task->cnswap,
+		0UL,
+		0UL,
 		task->exit_signal,
 		task_cpu(task),
 		task->rt_priority,
diff -puN include/linux/sched.h~remove-nswap-cnswap include/linux/sched.h
--- 25/include/linux/sched.h~remove-nswap-cnswap	2004-04-08 13:43:35.363104800 -0700
+++ 25-akpm/include/linux/sched.h	2004-04-08 13:43:35.374103128 -0700
@@ -436,7 +436,7 @@ struct task_struct {
 	unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; /* context switch counts */
 	u64 start_time;
 /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
-	unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap;
+	unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
 /* process credentials */
 	uid_t uid,euid,suid,fsuid;
 	gid_t gid,egid,sgid,fsgid;
diff -puN kernel/acct.c~remove-nswap-cnswap kernel/acct.c
--- 25/kernel/acct.c~remove-nswap-cnswap	2004-04-08 13:43:35.364104648 -0700
+++ 25-akpm/kernel/acct.c	2004-04-08 13:43:35.375102976 -0700
@@ -376,7 +376,7 @@ static void do_acct_process(long exitcod
 	ac.ac_rw = encode_comp_t(ac.ac_io / 1024);
 	ac.ac_minflt = encode_comp_t(current->min_flt);
 	ac.ac_majflt = encode_comp_t(current->maj_flt);
-	ac.ac_swaps = encode_comp_t(current->nswap);
+	ac.ac_swaps = encode_comp_t(0);
 	ac.ac_exitcode = exitcode;
 
 	/*
diff -puN kernel/exit.c~remove-nswap-cnswap kernel/exit.c
--- 25/kernel/exit.c~remove-nswap-cnswap	2004-04-08 13:43:35.366104344 -0700
+++ 25-akpm/kernel/exit.c	2004-04-08 13:43:35.375102976 -0700
@@ -92,7 +92,6 @@ repeat: 
 	p->parent->cstime += p->stime + p->cstime;
 	p->parent->cmin_flt += p->min_flt + p->cmin_flt;
 	p->parent->cmaj_flt += p->maj_flt + p->cmaj_flt;
-	p->parent->cnswap += p->nswap + p->cnswap;
 	p->parent->cnvcsw += p->nvcsw + p->cnvcsw;
 	p->parent->cnivcsw += p->nivcsw + p->cnivcsw;
 	sched_exit(p);
diff -puN kernel/fork.c~remove-nswap-cnswap kernel/fork.c
--- 25/kernel/fork.c~remove-nswap-cnswap	2004-04-08 13:43:35.368104040 -0700
+++ 25-akpm/kernel/fork.c	2004-04-08 13:43:35.376102824 -0700
@@ -513,7 +513,6 @@ static int copy_mm(unsigned long clone_f
 
 	tsk->min_flt = tsk->maj_flt = 0;
 	tsk->cmin_flt = tsk->cmaj_flt = 0;
-	tsk->nswap = tsk->cnswap = 0;
 	tsk->nvcsw = tsk->nivcsw = tsk->cnvcsw = tsk->cnivcsw = 0;
 
 	tsk->mm = NULL;
diff -puN kernel/sys.c~remove-nswap-cnswap kernel/sys.c
--- 25/kernel/sys.c~remove-nswap-cnswap	2004-04-08 13:43:35.369103888 -0700
+++ 25-akpm/kernel/sys.c	2004-04-08 13:43:35.378102520 -0700
@@ -1532,7 +1532,6 @@ int getrusage(struct task_struct *p, int
 			r.ru_nivcsw = p->nivcsw;
 			r.ru_minflt = p->min_flt;
 			r.ru_majflt = p->maj_flt;
-			r.ru_nswap = p->nswap;
 			break;
 		case RUSAGE_CHILDREN:
 			jiffies_to_timeval(p->cutime, &r.ru_utime);
@@ -1541,7 +1540,6 @@ int getrusage(struct task_struct *p, int
 			r.ru_nivcsw = p->cnivcsw;
 			r.ru_minflt = p->cmin_flt;
 			r.ru_majflt = p->cmaj_flt;
-			r.ru_nswap = p->cnswap;
 			break;
 		default:
 			jiffies_to_timeval(p->utime + p->cutime, &r.ru_utime);
@@ -1550,7 +1548,6 @@ int getrusage(struct task_struct *p, int
 			r.ru_nivcsw = p->nivcsw + p->cnivcsw;
 			r.ru_minflt = p->min_flt + p->cmin_flt;
 			r.ru_majflt = p->maj_flt + p->cmaj_flt;
-			r.ru_nswap = p->nswap + p->cnswap;
 			break;
 	}
 	return copy_to_user(ru, &r, sizeof(r)) ? -EFAULT : 0;

_
