Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1241919

Re: [PATCH] percpu_counter: return precise count from __percpu_counter_compare()

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] percpu_counter: return precise count from __percpu_counter_compare()
Date 2015-10-08 03:10 +0200
Message-ID <qh7Sy-51D-13@gated-at.bofh.it> (permalink)
References (5 earlier) <qgI7M-1zn-15@gated-at.bofh.it> <qh3ce-6Lp-3@gated-at.bofh.it> <qh60p-2mN-11@gated-at.bofh.it> <qh6jM-2J5-1@gated-at.bofh.it> <qh7Sy-51D-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] percpu_counter: return precise count from __percpu_counter_compare() Waiman Long <waiman.long@hpe.com> - 2015-10-06 01:10 +0200
  Re: [PATCH] percpu_counter: return precise count from  __percpu_counter_compare() Dave Chinner <david@fromorbit.com> - 2015-10-06 02:30 +0200
    Re: [PATCH] percpu_counter: return precise count from __percpu_counter_compare() Waiman Long <waiman.long@hpe.com> - 2015-10-06 19:40 +0200
      Re: [PATCH] percpu_counter: return precise count from  __percpu_counter_compare() Dave Chinner <david@fromorbit.com> - 2015-10-06 23:40 +0200
        Re: [PATCH] percpu_counter: return precise count from __percpu_counter_compare() Waiman Long <waiman.long@hpe.com> - 2015-10-07 22:10 +0200
          Re: [PATCH] percpu_counter: return precise count from  __percpu_counter_compare() Dave Chinner <david@fromorbit.com> - 2015-10-08 01:10 +0200
            Re: [PATCH] percpu_counter: return precise count from  __percpu_counter_compare() Tejun Heo <tj@kernel.org> - 2015-10-08 01:30 +0200
              Re: [PATCH] percpu_counter: return precise count from  __percpu_counter_compare() Dave Chinner <david@fromorbit.com> - 2015-10-08 03:10 +0200
                Re: [PATCH] percpu_counter: return precise count from  __percpu_counter_compare() Tejun Heo <tj@kernel.org> - 2015-10-08 03:10 +0200
                Re: [PATCH] percpu_counter: return precise count from __percpu_counter_compare() Waiman Long <waiman.long@hpe.com> - 2015-10-08 18:10 +0200
            Re: [PATCH] percpu_counter: return precise count from __percpu_counter_compare() Waiman Long <waiman.long@hpe.com> - 2015-10-08 18:10 +0200

csiph-web