the percpu_counter_*_positive() API SMP and UP aren't consistent. Add comments to explain it. Also if count < 0, returns 0 instead of 1 for *read_positive(). Signed-off-by: Shaohua Li --- include/linux/percpu_counter.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) Index: linux/include/linux/percpu_counter.h =================================================================== --- linux.orig/include/linux/percpu_counter.h 2011-04-13 13:10:13.000000000 +0800 +++ linux/include/linux/percpu_counter.h 2011-04-13 13:21:21.000000000 +0800 @@ -75,7 +75,7 @@ static inline s64 percpu_counter_read_po barrier(); /* Prevent reloads of fbc->count */ if (ret >= 0) return ret; - return 1; + return 0; } static inline int percpu_counter_initialized(struct percpu_counter *fbc) @@ -135,6 +135,10 @@ static inline s64 percpu_counter_read(st static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc) { + /* + * percpu_counter is intended to track positive number. In UP case, the + * number should never be negative. + */ return fbc->count; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/