Re: [PATCH v5 1/3] refcount: Create unchecked atomic_t implementation

2017-06-01 Thread Kees Cook
On Wed, May 31, 2017 at 4:09 AM, Peter Zijlstra wrote: > On Wed, May 31, 2017 at 10:45:09AM +, Reshetova, Elena wrote: > >> > +static inline __must_check bool refcount_add_not_zero(unsigned int i, >> > + >> > refcount_t *r) >> > +{ >> > + return

Re: [PATCH v5 1/3] refcount: Create unchecked atomic_t implementation

2017-06-01 Thread Kees Cook
On Wed, May 31, 2017 at 4:09 AM, Peter Zijlstra wrote: > On Wed, May 31, 2017 at 10:45:09AM +, Reshetova, Elena wrote: > >> > +static inline __must_check bool refcount_add_not_zero(unsigned int i, >> > + >> > refcount_t *r) >> > +{ >> > + return atomic_add_return(i, >refs) != 0;

Re: [PATCH v5 1/3] refcount: Create unchecked atomic_t implementation

2017-05-31 Thread Peter Zijlstra
On Wed, May 31, 2017 at 10:45:09AM +, Reshetova, Elena wrote: > > +static inline __must_check bool refcount_add_not_zero(unsigned int i, > > + > > refcount_t *r) > > +{ > > + return atomic_add_return(i, >refs) != 0; > > +} > > Maybe atomic_add_unless(>refs, i, 0) in order to be

Re: [PATCH v5 1/3] refcount: Create unchecked atomic_t implementation

2017-05-31 Thread Peter Zijlstra
On Wed, May 31, 2017 at 10:45:09AM +, Reshetova, Elena wrote: > > +static inline __must_check bool refcount_add_not_zero(unsigned int i, > > + > > refcount_t *r) > > +{ > > + return atomic_add_return(i, >refs) != 0; > > +} > > Maybe atomic_add_unless(>refs, i, 0) in order to be

RE: [PATCH v5 1/3] refcount: Create unchecked atomic_t implementation

2017-05-31 Thread Reshetova, Elena
> > Many subsystems will not use refcount_t unless there is a way to build the > kernel so that there is no regression in speed compared to atomic_t. This > adds CONFIG_REFCOUNT_FULL to enable the full refcount_t implementation > which has the validation but is slightly slower. When not enabled,

RE: [PATCH v5 1/3] refcount: Create unchecked atomic_t implementation

2017-05-31 Thread Reshetova, Elena
> > Many subsystems will not use refcount_t unless there is a way to build the > kernel so that there is no regression in speed compared to atomic_t. This > adds CONFIG_REFCOUNT_FULL to enable the full refcount_t implementation > which has the validation but is slightly slower. When not enabled,

[PATCH v5 1/3] refcount: Create unchecked atomic_t implementation

2017-05-30 Thread Kees Cook
Many subsystems will not use refcount_t unless there is a way to build the kernel so that there is no regression in speed compared to atomic_t. This adds CONFIG_REFCOUNT_FULL to enable the full refcount_t implementation which has the validation but is slightly slower. When not enabled, refcount_t

[PATCH v5 1/3] refcount: Create unchecked atomic_t implementation

2017-05-30 Thread Kees Cook
Many subsystems will not use refcount_t unless there is a way to build the kernel so that there is no regression in speed compared to atomic_t. This adds CONFIG_REFCOUNT_FULL to enable the full refcount_t implementation which has the validation but is slightly slower. When not enabled, refcount_t