From: Peter Zijlstra Date: Sat, 10 Dec 2011 10:43:44 +0000 (+0100) Subject: kref: Remove the memory barriers X-Git-Tag: v3.3-rc1~30^2~1^2~7 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c8ed88974472b928489e3943616500ce2ad0cd8;p=pandora-kernel.git kref: Remove the memory barriers Commit 1b0b3b9980e ("kref: fix CPU ordering with respect to krefs") wrongly adds memory barriers to kref. It states: some atomic operations are only atomic, not ordered. Thus a CPU is allowed to reorder memory references to an object to before the reference is obtained. This fixes it. While true, it fails to show why this is a problem. I say it is not a problem because if there is a race with kref_put() such that we could end up referencing a free'd object without this memory barrier, we would still have that race with the memory barrier. The kref_put() in question could complete (and free the object) before the atomic_inc() and we'd still be up shit creek. The kref_init() case is even worse, if your object is published at this time you're so wrong the memory barrier won't make a difference what so ever. If its not published, the act of publishing should include the needed barriers/locks to make sure all writes prior to the act of publishing are complete such that others will only observe a complete object. Cc: Alexey Dobriyan Cc: Eric Dumazet Cc: Ingo Molnar Cc: Oliver Neukum Signed-off-by: Peter Zijlstra Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed