convert CONFIG tag for a few accounting data used by CSA
Subsystems (4)
PATCH 3/3 convert CONFIG tag for a few accounting data used by CSA
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.
include/linux/acct.h +0 -4
@@ -124,16 +124,12 @@ extern void acct_auto_close(struct superextern 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 /*
include/linux/csa_kern.h +8 -0
@@ -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 */
kernel/acct.c +0 -30
@@ -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 ; -}
kernel/csa.c +32 -0
@@ -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 ; +}
include/linux/sched.h +1 -1
@@ -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 */
fs/compat.c +1 -1
@@ -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 */
fs/exec.c +1 -1
@@ -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>
kernel/exit.c +1 -0
@@ -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>
kernel/fork.c +1 -0
@@ -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>
kernel/sched.c +1 -1
@@ -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>
Quoted 39 lines · Jay Lan
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 fromCONFIG_BSD_PROCESS_ACCTtoCONFIG_CSA_ACCT. A few defines are moved fromkernel/acct.candinclude/linux/acct.htokernel/csa.candinclude/linux/csa_kern.h.Signed-off-by Jay Lan <[email protected]>------------------------------------------------------------------------
Index:
linux/include/linux/acct.h
===================================================================include/linux/acct.h +0
-4@@ -124,16 +124,12 @@ extern void acct_auto_close(struct superextern 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
===================================================================include/linux/csa_kern.h +0
-0@@ -28,4 +28,12 @@ extern void csa_add_tsk(struct taskstats*/
include/linux/csa_kern.h extern void csa_add_tsk(struct taskstats · line 38
Quoted 10 lines
include/linux/csa_kern.h +8
-0#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
Quoted 8 lines
include/linux/csa_kern.h +0
-0#endif /* _CSA_KERN_H */ Index:
linux/kernel/acct.c
===================================================================kernel/acct.c +0
-0@@ -598,33 +598,3 @@ void acct_process(void)do_acct_process (file);fput (file);
<snip>
Quoted 9 lines · Shailabh Nagar
Quoted 8 lines · Jay Lan
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 fromCONFIG_BSD_PROCESS_ACCTtoCONFIG_CSA_ACCT. A few defines are moved fromkernel/acct.candinclude/linux/acct.htokernel/csa.candinclude/linux/csa_kern.h.Signed-off-by Jay Lan <[email protected]>
[snip]
Quoted 10 lines
include/linux/csa_kern.h extern void csa_add_tsk(struct taskstats · line 38
Quoted 8 lines
include/linux/csa_kern.h +8
-0+#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
Quoted 24 lines · On Wed, 02 Aug 2006 09:26:02 +0200 Jes Sorensen <[email protected]> wrote:
Quoted 9 lines · Shailabh Nagar
Quoted 8 lines · Jay Lan
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 fromCONFIG_BSD_PROCESS_ACCTtoCONFIG_CSA_ACCT. A few defines are moved fromkernel/acct.candinclude/linux/acct.htokernel/csa.candinclude/linux/csa_kern.h.Signed-off-by Jay Lan <[email protected]>[snip]
Quoted 10 lines
include/linux/csa_kern.h extern void csa_add_tsk(struct taskstats · line 38
Quoted 8 lines
include/linux/csa_kern.h +8
-0+#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
Quoted 2 lines
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 ;)
Quoted 4 lines · Andrew Morton
Quoted 2 lines · On Wed, 02 Aug 2006 09:26:02 +0200 Jes Sorensen <[email protected]> wrote:
Quoted 1 line · Shailabh Nagar
static inlines preferred
Quoted 8 lines
Quoted 2 lines
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