Re: [PATCH v3 1/7] seqnum_ops: Introduce Sequence Number Ops

2021-02-07 Thread Randy Dunlap
Hi-- Comments are inline. On 2/3/21 10:11 AM, Shuah Khan wrote: > Sequence Number api provides interfaces for unsigned atomic up counters. > > There are a number of atomic_t usages in the kernel where atomic_t api > is used for counting sequence numbers and other statistical counters. > Several

Re: [PATCH v3 1/7] seqnum_ops: Introduce Sequence Number Ops

2021-02-05 Thread Luck, Tony
On Fri, Feb 05, 2021 at 01:03:18PM -0700, Shuah Khan wrote: > On 2/5/21 2:58 AM, Greg KH wrote: > > On Wed, Feb 03, 2021 at 11:11:57AM -0700, Shuah Khan wrote: > > > +static inline u32 seqnum32_inc(struct seqnum32 *seq) > > > +{ > > > + atomic_t val = ATOMIC_INIT(seq->seqnum); > > > + > > > +

Re: [PATCH v3 1/7] seqnum_ops: Introduce Sequence Number Ops

2021-02-05 Thread Greg KH
On Wed, Feb 03, 2021 at 11:11:57AM -0700, Shuah Khan wrote: > +static inline u32 seqnum32_inc(struct seqnum32 *seq) > +{ > + atomic_t val = ATOMIC_INIT(seq->seqnum); > + > + seq->seqnum = (u32) atomic_inc_return(); > + if (seq->seqnum >= UINT_MAX) > + pr_info("Sequence

Re: [PATCH v3 1/7] seqnum_ops: Introduce Sequence Number Ops

2021-02-05 Thread Shuah Khan
On 2/5/21 2:58 AM, Greg KH wrote: On Wed, Feb 03, 2021 at 11:11:57AM -0700, Shuah Khan wrote: +static inline u32 seqnum32_inc(struct seqnum32 *seq) +{ + atomic_t val = ATOMIC_INIT(seq->seqnum); + + seq->seqnum = (u32) atomic_inc_return(); + if (seq->seqnum >= UINT_MAX) +

Re: [PATCH v3 1/7] seqnum_ops: Introduce Sequence Number Ops

2021-02-04 Thread Peter Zijlstra
On Wed, Feb 03, 2021 at 11:11:57AM -0700, Shuah Khan wrote: > +static inline u32 seqnum32_inc(struct seqnum32 *seq) > +{ > + atomic_t val = ATOMIC_INIT(seq->seqnum); > + > + seq->seqnum = (u32) atomic_inc_return(); > + if (seq->seqnum >= UINT_MAX) > + pr_info("Sequence

[PATCH v3 1/7] seqnum_ops: Introduce Sequence Number Ops

2021-02-03 Thread Shuah Khan
Sequence Number api provides interfaces for unsigned atomic up counters. There are a number of atomic_t usages in the kernel where atomic_t api is used for counting sequence numbers and other statistical counters. Several of these usages, convert atomic_read() and atomic_inc_return() return