From: Peter Zijlstra Date: Wed, 17 Oct 2007 06:25:42 +0000 (-0700) Subject: lib: percpu_counter_sub X-Git-Tag: v2.6.24-rc1~813 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3cb4f9fa0c5f3ded9f70f85b70ee6d429834f911;p=pandora-kernel.git lib: percpu_counter_sub Hugh spotted that some code does: percpu_counter_add(&counter, -unsignedlong) which, when the amount argument is of type s32, sort-of works thanks to two's-complement. However when we'd change the type to s64 this breaks on 32bit machines, because the promotion rules zero extend the unsigned number. Provide percpu_counter_sub() to hide the s64 cast. That is: percpu_counter_sub(&counter, foo) is equal to: percpu_counter_add(&counter, -(s64)foo); Signed-off-by: Peter Zijlstra Cc: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed