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

Stefan Bader stefan.bader at canonical.com
Thu Jul 27 14:38:06 UTC 2017


On 21.07.2017 17:50, 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>
> ---
>  drivers/block/drbd/drbd_req.c                |  2 +-
>  drivers/block/rbd.c                          |  8 +++---
>  drivers/block/virtio_blk.c                   |  2 +-
>  drivers/gpu/drm/drm_gem_cma_helper.c         |  2 +-
>  drivers/gpu/drm/drm_info.c                   |  2 +-
>  drivers/gpu/drm/drm_mode_object.c            |  4 +--
>  drivers/gpu/drm/etnaviv/etnaviv_gem.c        |  2 +-
>  drivers/gpu/drm/i915/i915_gem_object.h       |  2 +-
>  drivers/gpu/drm/msm/msm_gem.c                |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_fence.c      |  2 +-
>  drivers/gpu/drm/omapdrm/omap_gem.c           |  2 +-
>  drivers/gpu/drm/ttm/ttm_bo.c                 |  4 +--
>  drivers/gpu/drm/ttm/ttm_object.c             |  2 +-
>  drivers/infiniband/hw/cxgb3/iwch_cm.h        |  6 ++---
>  drivers/infiniband/hw/cxgb3/iwch_qp.c        |  2 +-
>  drivers/infiniband/hw/cxgb4/iw_cxgb4.h       |  6 ++---
>  drivers/infiniband/hw/cxgb4/qp.c             |  2 +-
>  drivers/infiniband/hw/usnic/usnic_ib_sysfs.c |  6 ++---
>  drivers/infiniband/hw/usnic/usnic_ib_verbs.c |  4 +--
>  drivers/misc/genwqe/card_dev.c               |  2 +-
>  drivers/misc/mei/debugfs.c                   |  2 +-
>  drivers/pci/hotplug/pnv_php.c                |  2 +-
>  drivers/pci/slot.c                           |  2 +-
>  drivers/scsi/bnx2fc/bnx2fc_io.c              |  8 +++---
>  drivers/scsi/cxgbi/libcxgbi.h                |  4 +--
>  drivers/scsi/lpfc/lpfc_debugfs.c             |  2 +-
>  drivers/scsi/lpfc/lpfc_els.c                 |  2 +-
>  drivers/scsi/lpfc/lpfc_hbadisc.c             | 40 ++++++++++++++--------------
>  drivers/scsi/lpfc/lpfc_init.c                |  3 +--
>  drivers/scsi/qla2xxx/tcm_qla2xxx.c           |  4 +--
>  drivers/staging/android/ion/ion.c            |  2 +-
>  drivers/staging/comedi/comedi_buf.c          |  2 +-
>  drivers/target/target_core_pr.c              | 10 +++----
>  drivers/target/tcm_fc/tfc_sess.c             |  2 +-
>  drivers/usb/gadget/function/f_fs.c           |  2 +-
>  fs/exofs/sys.c                               |  2 +-
>  fs/ocfs2/cluster/netdebug.c                  |  2 +-
>  fs/ocfs2/cluster/tcp.c                       |  2 +-
>  fs/ocfs2/dlm/dlmdebug.c                      | 12 ++++-----
>  fs/ocfs2/dlm/dlmdomain.c                     |  2 +-
>  fs/ocfs2/dlm/dlmmaster.c                     |  8 +++---
>  fs/ocfs2/dlm/dlmunlock.c                     |  2 +-
>  include/drm/drm_framebuffer.h                |  2 +-
>  include/drm/ttm/ttm_bo_driver.h              |  4 +--
>  include/linux/kref.h                         |  5 ++++
>  include/linux/sunrpc/cache.h                 |  2 +-
>  include/net/bluetooth/hci_core.h             |  4 +--
>  net/bluetooth/6lowpan.c                      |  2 +-
>  net/bluetooth/a2mp.c                         |  4 +--
>  net/bluetooth/amp.c                          |  4 +--
>  net/bluetooth/l2cap_core.c                   |  4 +--
>  net/ceph/messenger.c                         |  4 +--
>  net/ceph/osd_client.c                        | 10 +++----
>  net/sunrpc/cache.c                           |  2 +-
>  net/sunrpc/svc_xprt.c                        |  6 ++---
>  net/sunrpc/xprtrdma/svc_rdma_transport.c     |  4 +--
>  56 files changed, 121 insertions(+), 117 deletions(-)
> 

For SRU I would rather prefer to see the ppc kvm patches to change kref_read
back into a atomic_read(kref instead of mucking around with half the kernel.
Even with that being the way forward...

-Stefan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20170727/ad8ccab7/attachment.sig>


More information about the kernel-team mailing list