[Zesty][PATCH v2 09/11] locking/atomic, kref: Add kref_read()

Seth Forshee seth.forshee at canonical.com
Mon Jul 24 16:36:52 UTC 2017


On Fri, Jul 21, 2017 at 12:50:42PM -0300, Jose Ricardo Ziviani wrote:
> From: Peter Zijlstra <peterz at infradead.org>
> 
> BugLink: http://bugs.launchpad.net/bugs/1686019
> 
> Since we need to change the implementation, stop exposing internals.
> 
> Provide kref_read() to read the current reference count; typically
> used for debug messages.
> 
> Kills two anti-patterns:
> 
> 	atomic_read(&kref->refcount)
> 	kref->refcount.counter
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz at infradead.org>
> Cc: Andrew Morton <akpm at linux-foundation.org>
> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> Cc: Linus Torvalds <torvalds at linux-foundation.org>
> Cc: Paul E. McKenney <paulmck at linux.vnet.ibm.com>
> Cc: Peter Zijlstra <peterz at infradead.org>
> Cc: Thomas Gleixner <tglx at linutronix.de>
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Ingo Molnar <mingo at kernel.org>
> (cherry picked from commit 2c935bc57221cc2edc787c72ea0e2d30cdcd3d5e)
> Signed-off-by: Jose Ricardo Ziviani <joserz at linux.vnet.ibm.com>

The patch which intorduces a call to kref_read() precedes this patch,
which breaks bisectability. So at minimum this patch should be moved to
precede any use of kref_read(). I guess Thadeu can comment on whether
you should resend or if he will just reorder them when applying.

I'm also not terribly excited about all the churn in this patch, but it
doesn't look like it should cause any functional change so I won't
object.

Seth





More information about the kernel-team mailing list