mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Dave Chinner <david@fromorbit.com>
Cc: Waiman Long <waiman.long@hpe.com>,
	Christoph Lameter <cl@linux-foundation.org>,
	linux-kernel@vger.kernel.org, xfs@oss.sgi.com,
	Scott J Norton <scott.norton@hpe.com>,
	Douglas Hatch <doug.hatch@hpe.com>
Subject: Re: [PATCH] percpu_counter: return precise count from __percpu_counter_compare()
Date: Wed, 7 Oct 2015 18:09:47 -0700	[thread overview]
Message-ID: <20151008010947.GB21142@mtj.duckdns.org> (raw)
In-Reply-To: <20151008010218.GT27164@dastard>

Hello, Dave.

On Thu, Oct 08, 2015 at 12:02:18PM +1100, Dave Chinner wrote:
> > percpu cmpxchg is no different from sub or any other operations
> > regarding cross-CPU synchronization.  They're safe iff the operations
> > are on the local CPU.  They have to be made atomics if they need to be
> > manipulated from remote CPUs.
> 
> Again, another trivially solvable problem, but still irrelevant
> because we don't have the data that tells us whether changing the
> counter behaviour solves the problem....

Dude, it isn't trivially solvable.  You either can't do it or have to
pay the overhead during local access to get around it.

> > That said, while we can't manipulate the percpu counters directly, we
> > can add a separate global counter to cache sum result from the
> > previous run which gets automatically invalidated when any percpu
> > counter overflows.
> >
> > That should give better and in case of
> > back-to-back invocations pretty good precision compared to just
> > returning the global overflow counter.  Interface-wise, that'd be a
> > lot easier to deal with although I have no idea whether it'd fit this
> > particular use case or whether this use case even exists.
> 
> No, it doesn't help - it's effectively what Waiman's original patch
> did by returning the count from the initial comparison and using
> that for ENOSPC detection instead of doing a second comparison...

Just chipping in purely from percpu side.  If what Waiman suggested is
something useable, caching the result inside percpu_counter would be a
better interface.  If not, no idea.

Thanks.

-- 
tejun

  reply	other threads:[~2015-10-08  1:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 17:29 Waiman Long
2015-10-02 18:04 ` kbuild test robot
2015-10-05 23:03   ` Waiman Long
2015-10-02 18:05 ` kbuild test robot
2015-10-02 18:12 ` kbuild test robot
2015-10-02 18:15 ` kbuild test robot
2015-10-02 22:16 ` Dave Chinner
2015-10-05 23:02   ` Waiman Long
2015-10-06  0:25     ` Dave Chinner
2015-10-06 17:33       ` Waiman Long
2015-10-06 21:30         ` Dave Chinner
2015-10-07 20:00           ` Waiman Long
2015-10-07 23:04             ` Dave Chinner
2015-10-07 23:20               ` Tejun Heo
2015-10-08  1:02                 ` Dave Chinner
2015-10-08  1:09                   ` Tejun Heo [this message]
2015-10-08 16:06                   ` Waiman Long
2015-10-08 16:01               ` Waiman Long

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=20151008010947.GB21142@mtj.duckdns.org \
    --to=tj@kernel.org \
    --cc=cl@linux-foundation.org \
    --cc=david@fromorbit.com \
    --cc=doug.hatch@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=scott.norton@hpe.com \
    --cc=waiman.long@hpe.com \
    --cc=xfs@oss.sgi.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®