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


Groups > linux.kernel > #1526796

RE: [RFC][PATCH 2/7] kref: Add kref_read()

From "Reshetova, Elena" <elena.reshetova@intel.com>
Newsgroups linux.kernel
Subject RE: [RFC][PATCH 2/7] kref: Add kref_read()
Date 2016-11-21 16:40 +0100
Message-ID <sFYRj-2Wx-3@gated-at.bofh.it> (permalink)
References <sEeGS-7vu-25@gated-at.bofh.it> <sEqI1-6MO-9@gated-at.bofh.it> <sEyFz-3CT-19@gated-at.bofh.it> <sEViN-1Hy-3@gated-at.bofh.it> <sFWcO-1f8-41@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> By the way, there are several sites where the use of
> atomic_t/atomic_wrap_t as a counter ventures beyond the standard (inc,
> dec, add, sub, read, set) operations we're planning on implementing
> for both refcount_t and stats_t. 

Speaking of non-fitting patterns. This one is quite common in networking code for refcounters:

if (atomic_cmpxchg(&cur->refcnt, 1, 0) == 1) {}
This is from  net/netfilter/nfnetlink_acct.c, but there are similar ones in other places. 

Also, simple atomic_dec() is used pretty much everywhere for counters, which we don’t have a straight match in refcount_t API.

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


Thread

Re: [RFC][PATCH 2/7] kref: Add kref_read() Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-11-16 21:10 +0100
  Re: [RFC][PATCH 2/7] kref: Add kref_read() Peter Zijlstra <peterz@infradead.org> - 2016-11-17 10:00 +0100
    Re: [RFC][PATCH 2/7] kref: Add kref_read() Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-11-17 18:30 +0100
      Re: [RFC][PATCH 2/7] kref: Add kref_read() Thomas Gleixner <tglx@linutronix.de> - 2016-11-17 18:30 +0100
      RE: [RFC][PATCH 2/7] kref: Add kref_read() "Reshetova, Elena" <elena.reshetova@intel.com> - 2016-11-18 18:40 +0100
        Re: [RFC][PATCH 2/7] kref: Add kref_read() Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-11-19 04:50 +0100
          RE: [RFC][PATCH 2/7] kref: Add kref_read() "Reshetova, Elena" <elena.reshetova@intel.com> - 2016-11-21 09:20 +0100
        Re: [RFC][PATCH 2/7] kref: Add kref_read() David Windsor <dwindsor@gmail.com> - 2016-11-21 13:50 +0100
          RE: [RFC][PATCH 2/7] kref: Add kref_read() "Reshetova, Elena" <elena.reshetova@intel.com> - 2016-11-21 16:40 +0100
            Re: [RFC][PATCH 2/7] kref: Add kref_read() Peter Zijlstra <peterz@infradead.org> - 2016-11-21 16:50 +0100
              Re: [RFC][PATCH 2/7] kref: Add kref_read() Peter Zijlstra <peterz@infradead.org> - 2016-11-21 17:10 +0100
                RE: [RFC][PATCH 2/7] kref: Add kref_read() "Reshetova, Elena" <elena.reshetova@intel.com> - 2016-11-21 20:30 +0100
                Re: [RFC][PATCH 2/7] kref: Add kref_read() David Windsor <dwindsor@gmail.com> - 2016-11-21 21:20 +0100
                Re: [RFC][PATCH 2/7] kref: Add kref_read() Peter Zijlstra <peterz@infradead.org> - 2016-11-22 11:40 +0100

csiph-web