All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Elena Reshetova <elena.reshetova@intel.com>
Cc: darrick.wong@oracle.com, linux-kernel@vger.kernel.org,
	linux-xfs@vger.kernel.org, peterz@infradead.org,
	keescook@chromium.org
Subject: Re: [PATCH 0/5] xfs refcount conversions
Date: Sat, 21 Oct 2017 10:21:11 +1100	[thread overview]
Message-ID: <20171020232111.GT3666@dastard> (raw)
In-Reply-To: <1508497678-10508-1-git-send-email-elena.reshetova@intel.com>

On Fri, Oct 20, 2017 at 02:07:53PM +0300, Elena Reshetova wrote:
> Note: our previous thread didn't finish in any conclusion, so
> I am resending this now (rebased at latest linux-next) to revive
> the discussion. refcount_t is slowly becoming a standard for
> refcounters and we would really like to make all conversions
> done where it is applicable.

In a separate "replace atomics with refcounts" discussion, the
ordering guarantees of refcounts was raised:

https://lkml.org/lkml/2017/9/4/206

i.e. refcounts use weak ordering whilst atomics imply a smp_mb()
operation was performed.

Given these counters in XFS directly define the life cycle states
rather than being just an object refcount, I'm pretty sure they
rely on the implied smp_mb() that the atomic operations provide to
work correctly.

Let me put it this way: Documentation/memory-barriers.txt breaks my
brain.

We know atomics provide the barriers we need for the code to work
correctly, but using anything else requires understanding the
ordering of the new code and what Documentation/memory-barriers.txt
says that means.

IMO, that makes it way too hard to review sanely for code that:

	a) we already know works correctly
	b) has guards against reference count problems; and
	c) isn't performance critical, so doesn't need the
	   complexity of tricky memory ordering and/or barriers.

So, really, it comes down to the fact that we know refcount_t is not
a straight drop in replacement for atomics, and that actually
verifying the change is correct requires an in depth understanding
of Documentation/memory-barriers.txt. IMO, that's way too much of a
long term maintenance and knowledge burden to add to what is a
simple set of reference counters...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  parent reply	other threads:[~2017-10-20 23:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20 11:07 [PATCH 0/5] xfs refcount conversions Elena Reshetova
2017-10-20 11:07 ` [PATCH 1/5] fs, xfs: convert xfs_bui_log_item.bui_refcount from atomic_t to refcount_t Elena Reshetova
2017-10-20 11:07 ` [PATCH 2/5] fs, xfs: convert xfs_efi_log_item.efi_refcount " Elena Reshetova
2017-10-20 11:07 ` [PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref " Elena Reshetova
2017-10-20 11:07 ` [PATCH 4/5] fs, xfs: convert xfs_cui_log_item.cui_refcount " Elena Reshetova
2017-10-20 11:07 ` [PATCH 5/5] fs, xfs: convert xfs_rui_log_item.rui_refcount " Elena Reshetova
2017-10-20 23:21 ` Dave Chinner [this message]
2017-10-23 10:29   ` [PATCH 0/5] xfs refcount conversions Reshetova, Elena
2017-10-23 13:41   ` Peter Zijlstra
2017-11-03  0:23     ` Dave Chinner
2017-11-03  8:19       ` Reshetova, Elena

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171020232111.GT3666@dastard \
    --to=david@fromorbit.com \
    --cc=darrick.wong@oracle.com \
    --cc=elena.reshetova@intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.