Re: [cpuops cmpxchg V2 4/5] vmstat: User per cpu atomics to avoidinterrupt disable / enable

From: Christoph Lameter
Date: Wed Dec 15 2010 - 12:01:36 EST


On Wed, 15 Dec 2010, Tejun Heo wrote:

> + /*
> + * The fetching of the stat_threshold is racy. We may apply
> + * a counter threshold to the wrong the cpu if we get
> + * rescheduled while executing here. However, the following
> + * will apply the threshold again and therefore bring the
> + * counter under the threshold.
> + */
>
> What does "the following" mean here? Later executions of the
> function? It seems like the counter can go out of the threshold at
> least temporarily, which probably is okay but I think the comment can
> be improved a bit.

I meant later execution of the function. I will fix the comment.

Subject: vmstat comment fix

Clarify comments for the threshold a bit.

Signed-off-by: Christoh Lameter <cl@xxxxxxxxx>

---
mm/vmstat.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

Index: linux-2.6/mm/vmstat.c
===================================================================
--- linux-2.6.orig/mm/vmstat.c 2010-12-15 10:57:44.000000000 -0600
+++ linux-2.6/mm/vmstat.c 2010-12-15 10:58:46.000000000 -0600
@@ -277,9 +277,12 @@ static inline void mod_state(struct zone
/*
* The fetching of the stat_threshold is racy. We may apply
* a counter threshold to the wrong the cpu if we get
- * rescheduled while executing here. However, the following
- * will apply the threshold again and therefore bring the
- * counter under the threshold.
+ * rescheduled while executing here. However, the next
+ * counter update will apply the threshold again and
+ * therefore bring the counter under the threshold again.
+ *
+ * Most of the time the thresholds are the same anyways
+ * for all cpus in a zone.
*/
t = this_cpu_read(pcp->stat_threshold);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/