The patch titled Use better names in schedstats has been removed from the -mm tree. Its filename is per-task-delay-accounting-cpu-delay-collection-via-schedstats-fix-1.patch This patch was dropped because it was folded into per-task-delay-accounting-cpu-delay-collection-via-schedstats.patch ------------------------------------------------------ Subject: Use better names in schedstats From: Balbir Singh <balbir@xxxxxxxxxx> On Mon, May 08, 2006 at 02:26:40PM -0700, Andrew Morton wrote: > Balbir Singh <balbir@xxxxxxxxxx> wrote: > > > > +/* > > + * Expects runqueue lock to be held for atomicity of update > > + */ > > +static inline void rq_sched_info_arrive(struct runqueue *rq, > > + unsigned long diff) > > +{ > > + if (rq) { > > + rq->rq_sched_info.run_delay += diff; > > + rq->rq_sched_info.pcnt++; > > + } > > +} > > + > > +/* > > + * Expects runqueue lock to be held for atomicity of update > > + */ > > +static inline void rq_sched_info_depart(struct runqueue *rq, > > + unsigned long diff) > > +{ > > + if (rq) > > + rq->rq_sched_info.cpu_time += diff; > > +} > > The kernel has many different units of time - jiffies, cpu ticks, ns, us, > ms, etc. So the reader of these functions doesn't have a clue what "diff" > is. > > A good way to remove all doubt in all cases is to include the units in the > variable's name. Something like delta_jiffies, perhaps. Hi, Andrew I have renamed all the "diff" to "delta_jiffies" to make it easier to read the code as suggested in the review comments. Balbir Singh, Linux Technology Center, IBM Software Labs Changelog 1. Clean up the usage of the names. Use names with units to make the code easier to read Signed-off-by: Balbir Singh <balbir@xxxxxxxxxx> Signed-off-by: Shailabh Nagar <nagar@xxxxxxxxxxxxxx> Cc: Jes Sorensen <jes@xxxxxxx> Cc: Peter Chubb <peterc@xxxxxxxxxxxxxxxxxx> Cc: Erich Focht <efocht@xxxxxxxxxx> Cc: Levent Serinol <lserinol@xxxxxxxxx> Cc: Jay Lan <jlan@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- kernel/sched.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff -puN kernel/sched.c~per-task-delay-accounting-cpu-delay-collection-via-schedstats-fix-1 kernel/sched.c --- a/kernel/sched.c~per-task-delay-accounting-cpu-delay-collection-via-schedstats-fix-1 +++ a/kernel/sched.c @@ -505,10 +505,11 @@ struct file_operations proc_schedstat_op /* * Expects runqueue lock to be held for atomicity of update */ -static inline void rq_sched_info_arrive(struct rq *rq, unsigned long diff) +static inline void +rq_sched_info_arrive(struct rq *rq, unsigned long delta_jiffies) { if (rq) { - rq->rq_sched_info.run_delay += diff; + rq->rq_sched_info.run_delay += delta_jiffies; rq->rq_sched_info.pcnt++; } } @@ -516,17 +517,20 @@ static inline void rq_sched_info_arrive( /* * Expects runqueue lock to be held for atomicity of update */ -static inline void rq_sched_info_depart(struct rq *rq, unsigned long diff) +static inline void +rq_sched_info_depart(struct rq *rq, unsigned long delta_jiffies) { if (rq) - rq->rq_sched_info.cpu_time += diff; + rq->rq_sched_info.cpu_time += delta_jiffies; } # define schedstat_inc(rq, field) do { (rq)->field++; } while (0) # define schedstat_add(rq, field, amt) do { (rq)->field += (amt); } while (0) #else /* !CONFIG_SCHEDSTATS */ -static inline void rq_sched_info_arrive(struct rq *rq, unsigned long diff) +static inline void +rq_sched_info_arrive(struct rq *rq, unsigned long delta_jiffies) {} -static inline void rq_sched_info_depart(struct rq *rq, unsigned long diff) +static inline void +rq_sched_info_depart(struct rq *rq, unsigned long delta_jiffies) {} # define schedstat_inc(rq, field) do { } while (0) # define schedstat_add(rq, field, amt) do { } while (0) @@ -575,16 +579,16 @@ static inline void sched_info_dequeued(s */ static void sched_info_arrive(struct task_struct *t) { - unsigned long now = jiffies, diff = 0; + unsigned long now = jiffies, delta_jiffies = 0; if (t->sched_info.last_queued) - diff = now - t->sched_info.last_queued; + delta_jiffies = now - t->sched_info.last_queued; sched_info_dequeued(t); - t->sched_info.run_delay += diff; + t->sched_info.run_delay += delta_jiffies; t->sched_info.last_arrival = now; t->sched_info.pcnt++; - rq_sched_info_arrive(task_rq(t), diff); + rq_sched_info_arrive(task_rq(t), delta_jiffies); } /* @@ -615,10 +619,10 @@ static inline void sched_info_queued(str */ static inline void sched_info_depart(struct task_struct *t) { - unsigned long diff = jiffies - t->sched_info.last_arrival; + unsigned long delta_jiffies = jiffies - t->sched_info.last_arrival; - t->sched_info.cpu_time += diff; - rq_sched_info_depart(task_rq(t), diff); + t->sched_info.cpu_time += delta_jiffies; + rq_sched_info_depart(task_rq(t), delta_jiffies); } /* _ Patches currently in -mm which might be from balbir@xxxxxxxxxx are origin.patch per-task-delay-accounting-setup.patch per-task-delay-accounting-sync-block-i-o-and-swapin-delay-collection.patch per-task-delay-accounting-cpu-delay-collection-via-schedstats.patch per-task-delay-accounting-cpu-delay-collection-via-schedstats-fix-1.patch per-task-delay-accounting-utilities-for-genetlink-usage.patch per-task-delay-accounting-taskstats-interface.patch per-task-delay-accounting-taskstats-interface-fix-1.patch per-task-delay-accounting-taskstats-interface-fix-2.patch per-task-delay-accounting-taskstats-interface-tidy.patch per-task-delay-accounting-delay-accounting-usage-of-taskstats-interface.patch per-task-delay-accounting-documentation.patch per-task-delay-accounting-proc-export-of-aggregated-block-i-o-delays.patch per-task-delay-accounting-proc-export-of-aggregated-block-i-o-delays-warning-fix.patch delay-accounting-taskstats-interface-send-tgid-once.patch delay-accounting-taskstats-interface-send-tgid-once-fixes.patch per-task-delay-accounting-avoid-send-without-listeners.patch task-watchers-register-per-task-delay-accounting.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html