public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 3/3] convert CONFIG tag for a few accounting data used by CSA
@ 2006-07-31 19:23 Jay Lan
  2006-07-31 20:41 ` Shailabh Nagar
  0 siblings, 1 reply; 5+ messages in thread
From: Jay Lan @ 2006-07-31 19:23 UTC (permalink / raw)
  To: Andrew Morton
  Cc: lkml, Shailabh Nagar, Balbir Singh, Jes Sorensen,
	Chris Sturtivant, Tony Ernst

[-- Attachment #1: Type: text/plain, Size: 354 bytes --]

There were a few accounting data/macros that are used in CSA
but are #ifdef'ed inside CONFIG_BSD_PROCESS_ACCT. This patch is
to change those ifdef's from CONFIG_BSD_PROCESS_ACCT to
CONFIG_CSA_ACCT. A few defines are moved from kernel/acct.c and
include/linux/acct.h to kernel/csa.c and include/linux/csa_kern.h.


Signed-off-by:  Jay Lan <jlan@sgi.com>


[-- Attachment #2: csa-bsd-acct-update.patch --]
[-- Type: text/plain, Size: 6538 bytes --]

Index: linux/include/linux/acct.h
===================================================================
--- linux.orig/include/linux/acct.h	2006-07-20 11:38:51.956204769 -0700
+++ linux/include/linux/acct.h	2006-07-20 11:45:32.469053105 -0700
@@ -124,16 +124,12 @@ extern void acct_auto_close(struct super
 extern void acct_init_pacct(struct pacct_struct *pacct);
 extern void acct_collect(long exitcode, int group_dead);
 extern void acct_process(void);
-extern void acct_update_integrals(struct task_struct *tsk);
-extern void acct_clear_integrals(struct task_struct *tsk);
 #else
 #define acct_auto_close_mnt(x)	do { } while (0)
 #define acct_auto_close(x)	do { } while (0)
 #define acct_init_pacct(x)	do { } while (0)
 #define acct_collect(x,y)	do { } while (0)
 #define acct_process()		do { } while (0)
-#define acct_update_integrals(x)		do { } while (0)
-#define acct_clear_integrals(task)	do { } while (0)
 #endif
 
 /*
Index: linux/include/linux/csa_kern.h
===================================================================
--- linux.orig/include/linux/csa_kern.h	2006-07-20 11:44:05.079993220 -0700
+++ linux/include/linux/csa_kern.h	2006-07-20 11:47:16.266315471 -0700
@@ -28,4 +28,12 @@ extern void csa_add_tsk(struct taskstats
  */
 #define REV_CSA		07000	/* Kernel: CSA base record */
 
+#ifdef CONFIG_CSA_ACCT
+extern void acct_update_integrals(struct task_struct *tsk);
+extern void acct_clear_integrals(struct task_struct *tsk);
+#else
+#define acct_update_integrals(x)	do { } while (0)
+#define acct_clear_integrals(task)	do { } while (0)
+#endif
+
 #endif	/* _CSA_KERN_H */
Index: linux/kernel/acct.c
===================================================================
--- linux.orig/kernel/acct.c	2006-07-20 11:38:51.956204769 -0700
+++ linux/kernel/acct.c	2006-07-20 11:45:32.477053203 -0700
@@ -598,33 +598,3 @@ void acct_process(void)
 	do_acct_process(file);
 	fput(file);
 }
-
-
-/**
- * acct_update_integrals - update mm integral fields in task_struct
- * @tsk: task_struct for accounting
- */
-void acct_update_integrals(struct task_struct *tsk)
-{
-	if (likely(tsk->mm)) {
-		long delta =
-			cputime_to_jiffies(tsk->stime) - tsk->acct_stimexpd;
-
-		if (delta == 0)
-			return;
-		tsk->acct_stimexpd = tsk->stime;
-		tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm);
-		tsk->acct_vm_mem1 += delta * tsk->mm->total_vm;
-	}
-}
-
-/**
- * acct_clear_integrals - clear the mm integral fields in task_struct
- * @tsk: task_struct whose accounting fields are cleared
- */
-void acct_clear_integrals(struct task_struct *tsk)
-{
-	tsk->acct_stimexpd = 0;
-	tsk->acct_rss_mem1 = 0;
-	tsk->acct_vm_mem1 = 0;
-}
Index: linux/kernel/csa.c
===================================================================
--- linux.orig/kernel/csa.c	2006-07-20 11:45:18.364881535 -0700
+++ linux/kernel/csa.c	2006-07-20 11:45:32.477053203 -0700
@@ -44,3 +44,35 @@ void csa_add_tsk(struct taskstats *stats
 	stats->ac_scr	= p->syscr;
 	stats->ac_scw	= p->syscw;
 }
+
+
+
+
+/**
+ * acct_update_integrals - update mm integral fields in task_struct
+ * @tsk: task_struct for accounting
+ */
+void acct_update_integrals(struct task_struct *tsk)
+{
+	if (likely(tsk->mm)) {
+		long delta =
+			cputime_to_jiffies(tsk->stime) - tsk->acct_stimexpd;
+
+		if (delta == 0)
+			return;
+		tsk->acct_stimexpd = tsk->stime;
+		tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm);
+		tsk->acct_vm_mem1 += delta * tsk->mm->total_vm;
+	}
+}
+
+/**
+ * acct_clear_integrals - clear the mm integral fields in task_struct
+ * @tsk: task_struct whose accounting fields are cleared
+ */
+void acct_clear_integrals(struct task_struct *tsk)
+{
+	tsk->acct_stimexpd = 0;
+	tsk->acct_rss_mem1 = 0;
+	tsk->acct_vm_mem1 = 0;
+}
Index: linux/include/linux/sched.h
===================================================================
--- linux.orig/include/linux/sched.h	2006-07-20 11:38:51.956204769 -0700
+++ linux/include/linux/sched.h	2006-07-20 11:45:32.481053251 -0700
@@ -964,7 +964,7 @@ struct task_struct {
 	wait_queue_t *io_wait;
 /* i/o counters(bytes read/written, #syscalls */
 	u64 rchar, wchar, syscr, syscw;
-#if defined(CONFIG_BSD_PROCESS_ACCT)
+#if defined(CONFIG_CSA_ACCT)
 	u64 acct_rss_mem1;	/* accumulated rss usage */
 	u64 acct_vm_mem1;	/* accumulated virtual memory usage */
 	clock_t acct_stimexpd;	/* clock_t-converted stime since last update */
Index: linux/fs/compat.c
===================================================================
--- linux.orig/fs/compat.c	2006-07-20 11:38:52.028205640 -0700
+++ linux/fs/compat.c	2006-07-20 11:45:32.481053251 -0700
@@ -44,7 +44,7 @@
 #include <linux/nfsd/syscall.h>
 #include <linux/personality.h>
 #include <linux/rwsem.h>
-#include <linux/acct.h>
+#include <linux/csa_kern.h>
 #include <linux/mm.h>
 
 #include <net/sock.h>		/* siocdevprivate_ioctl */
Index: linux/fs/exec.c
===================================================================
--- linux.orig/fs/exec.c	2006-07-20 11:38:52.056205979 -0700
+++ linux/fs/exec.c	2006-07-20 11:45:32.485053300 -0700
@@ -46,7 +46,7 @@
 #include <linux/security.h>
 #include <linux/syscalls.h>
 #include <linux/rmap.h>
-#include <linux/acct.h>
+#include <linux/csa_kern.h>
 #include <linux/cn_proc.h>
 #include <linux/audit.h>
 
Index: linux/kernel/exit.c
===================================================================
--- linux.orig/kernel/exit.c	2006-07-20 11:38:51.956204769 -0700
+++ linux/kernel/exit.c	2006-07-20 11:45:32.489053349 -0700
@@ -18,6 +18,7 @@
 #include <linux/security.h>
 #include <linux/cpu.h>
 #include <linux/acct.h>
+#include <linux/csa_kern.h>
 #include <linux/file.h>
 #include <linux/binfmts.h>
 #include <linux/ptrace.h>
Index: linux/kernel/fork.c
===================================================================
--- linux.orig/kernel/fork.c	2006-07-20 11:38:51.956204769 -0700
+++ linux/kernel/fork.c	2006-07-20 11:45:32.489053349 -0700
@@ -42,6 +42,7 @@
 #include <linux/profile.h>
 #include <linux/rmap.h>
 #include <linux/acct.h>
+#include <linux/csa_kern.h>
 #include <linux/cn_proc.h>
 #include <linux/delayacct.h>
 #include <linux/taskstats_kern.h>
Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c	2006-07-20 11:38:51.956204769 -0700
+++ linux/kernel/sched.c	2006-07-20 11:45:32.493053397 -0700
@@ -49,7 +49,7 @@
 #include <linux/seq_file.h>
 #include <linux/syscalls.h>
 #include <linux/times.h>
-#include <linux/acct.h>
+#include <linux/csa_kern.h>
 #include <linux/kprobes.h>
 #include <linux/delayacct.h>
 #include <asm/tlb.h>


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

* Re: [patch 3/3] convert CONFIG tag for a few accounting data used by CSA
  2006-07-31 19:23 [patch 3/3] convert CONFIG tag for a few accounting data used by CSA Jay Lan
@ 2006-07-31 20:41 ` Shailabh Nagar
  2006-08-02  7:26   ` Jes Sorensen
  0 siblings, 1 reply; 5+ messages in thread
From: Shailabh Nagar @ 2006-07-31 20:41 UTC (permalink / raw)
  To: Jay Lan
  Cc: Andrew Morton, lkml, Balbir Singh, Jes Sorensen, Chris Sturtivant,
	Tony Ernst

Jay Lan wrote:
> There were a few accounting data/macros that are used in CSA
> but are #ifdef'ed inside CONFIG_BSD_PROCESS_ACCT. This patch is
> to change those ifdef's from CONFIG_BSD_PROCESS_ACCT to
> CONFIG_CSA_ACCT. A few defines are moved from kernel/acct.c and
> include/linux/acct.h to kernel/csa.c and include/linux/csa_kern.h.
> 
> 
> Signed-off-by:  Jay Lan <jlan@sgi.com>
> 
> 
> ------------------------------------------------------------------------
> 
> Index: linux/include/linux/acct.h
> ===================================================================
> --- linux.orig/include/linux/acct.h	2006-07-20 11:38:51.956204769 -0700
> +++ linux/include/linux/acct.h	2006-07-20 11:45:32.469053105 -0700
> @@ -124,16 +124,12 @@ extern void acct_auto_close(struct super
>  extern void acct_init_pacct(struct pacct_struct *pacct);
>  extern void acct_collect(long exitcode, int group_dead);
>  extern void acct_process(void);
> -extern void acct_update_integrals(struct task_struct *tsk);
> -extern void acct_clear_integrals(struct task_struct *tsk);
>  #else
>  #define acct_auto_close_mnt(x)	do { } while (0)
>  #define acct_auto_close(x)	do { } while (0)
>  #define acct_init_pacct(x)	do { } while (0)
>  #define acct_collect(x,y)	do { } while (0)
>  #define acct_process()		do { } while (0)
> -#define acct_update_integrals(x)		do { } while (0)
> -#define acct_clear_integrals(task)	do { } while (0)
>  #endif
>  
>  /*
> Index: linux/include/linux/csa_kern.h
> ===================================================================
> --- linux.orig/include/linux/csa_kern.h	2006-07-20 11:44:05.079993220 -0700
> +++ linux/include/linux/csa_kern.h	2006-07-20 11:47:16.266315471 -0700
> @@ -28,4 +28,12 @@ extern void csa_add_tsk(struct taskstats
>   */
>  #define REV_CSA		07000	/* Kernel: CSA base record */
>  
> +#ifdef CONFIG_CSA_ACCT
> +extern void acct_update_integrals(struct task_struct *tsk);
> +extern void acct_clear_integrals(struct task_struct *tsk);
> +#else
> +#define acct_update_integrals(x)	do { } while (0)
> +#define acct_clear_integrals(task)	do { } while (0)
> +#endif
> +

static inlines preferred

>  #endif	/* _CSA_KERN_H */
> Index: linux/kernel/acct.c
> ===================================================================
> --- linux.orig/kernel/acct.c	2006-07-20 11:38:51.956204769 -0700
> +++ linux/kernel/acct.c	2006-07-20 11:45:32.477053203 -0700
> @@ -598,33 +598,3 @@ void acct_process(void)
>  	do_acct_process(file);
>  	fput(file);

<snip>


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

* Re: [patch 3/3] convert CONFIG tag for a few accounting data used by CSA
  2006-07-31 20:41 ` Shailabh Nagar
@ 2006-08-02  7:26   ` Jes Sorensen
  2006-08-02  7:31     ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Jes Sorensen @ 2006-08-02  7:26 UTC (permalink / raw)
  To: Shailabh Nagar
  Cc: Jay Lan, Andrew Morton, lkml, Balbir Singh, Chris Sturtivant,
	Tony Ernst

Shailabh Nagar wrote:
> Jay Lan wrote:
>> There were a few accounting data/macros that are used in CSA
>> but are #ifdef'ed inside CONFIG_BSD_PROCESS_ACCT. This patch is
>> to change those ifdef's from CONFIG_BSD_PROCESS_ACCT to
>> CONFIG_CSA_ACCT. A few defines are moved from kernel/acct.c and
>> include/linux/acct.h to kernel/csa.c and include/linux/csa_kern.h.
>>
>>
>> Signed-off-by:  Jay Lan <jlan@sgi.com>

[snip]

>> +#ifdef CONFIG_CSA_ACCT
>> +extern void acct_update_integrals(struct task_struct *tsk);
>> +extern void acct_clear_integrals(struct task_struct *tsk);
>> +#else
>> +#define acct_update_integrals(x)	do { } while (0)
>> +#define acct_clear_integrals(task)	do { } while (0)
>> +#endif
>> +
> 
> static inlines preferred

Huh? Is that a preference to the taskstat project? For the kernel
itself it makes no difference.

Cheers,
Jes

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

* Re: [patch 3/3] convert CONFIG tag for a few accounting data used by CSA
  2006-08-02  7:26   ` Jes Sorensen
@ 2006-08-02  7:31     ` Andrew Morton
  2006-08-02  7:45       ` Jes Sorensen
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2006-08-02  7:31 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: nagar, jlan, linux-kernel, balbir, csturtiv, tee

On Wed, 02 Aug 2006 09:26:02 +0200
Jes Sorensen <jes@sgi.com> wrote:

> Shailabh Nagar wrote:
> > Jay Lan wrote:
> >> There were a few accounting data/macros that are used in CSA
> >> but are #ifdef'ed inside CONFIG_BSD_PROCESS_ACCT. This patch is
> >> to change those ifdef's from CONFIG_BSD_PROCESS_ACCT to
> >> CONFIG_CSA_ACCT. A few defines are moved from kernel/acct.c and
> >> include/linux/acct.h to kernel/csa.c and include/linux/csa_kern.h.
> >>
> >>
> >> Signed-off-by:  Jay Lan <jlan@sgi.com>
> 
> [snip]
> 
> >> +#ifdef CONFIG_CSA_ACCT
> >> +extern void acct_update_integrals(struct task_struct *tsk);
> >> +extern void acct_clear_integrals(struct task_struct *tsk);
> >> +#else
> >> +#define acct_update_integrals(x)	do { } while (0)
> >> +#define acct_clear_integrals(task)	do { } while (0)
> >> +#endif
> >> +
> > 
> > static inlines preferred
> 
> Huh? Is that a preference to the taskstat project? For the kernel
> itself it makes no difference.

static inlines provide typechecking and typo checking and presence-of-x
checking when the option is configged off.  They can also suppress unused
variable warnings.

And they're C, not cpp ;)


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

* Re: [patch 3/3] convert CONFIG tag for a few accounting data used by CSA
  2006-08-02  7:31     ` Andrew Morton
@ 2006-08-02  7:45       ` Jes Sorensen
  0 siblings, 0 replies; 5+ messages in thread
From: Jes Sorensen @ 2006-08-02  7:45 UTC (permalink / raw)
  To: Andrew Morton; +Cc: nagar, jlan, linux-kernel, balbir, csturtiv, tee

Andrew Morton wrote:
> On Wed, 02 Aug 2006 09:26:02 +0200
> Jes Sorensen <jes@sgi.com> wrote:
>> Shailabh Nagar wrote:
>>> static inlines preferred
>> Huh? Is that a preference to the taskstat project? For the kernel
>> itself it makes no difference.
> 
> static inlines provide typechecking and typo checking and presence-of-x
> checking when the option is configged off.  They can also suppress unused
> variable warnings.
> 
> And they're C, not cpp ;)

That I agree with, I guess I normally just draw the line between
functions that do actual work versus empty dummies like in this case.

Cheers,
Jes

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

end of thread, other threads:[~2006-08-02  7:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31 19:23 [patch 3/3] convert CONFIG tag for a few accounting data used by CSA Jay Lan
2006-07-31 20:41 ` Shailabh Nagar
2006-08-02  7:26   ` Jes Sorensen
2006-08-02  7:31     ` Andrew Morton
2006-08-02  7:45       ` Jes Sorensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox