Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1593680 > unrolled thread
| Started by | Tejun Heo <tj@kernel.org> |
|---|---|
| First post | 2017-03-06 21:00 +0100 |
| Last post | 2017-03-07 20:50 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 12/19] kernel: convert css_set.refcount from atomic_t to refcount_t Tejun Heo <tj@kernel.org> - 2017-03-06 21:00 +0100
RE: [PATCH 12/19] kernel: convert css_set.refcount from atomic_t to refcount_t "Reshetova, Elena" <elena.reshetova@intel.com> - 2017-03-07 20:20 +0100
Re: [PATCH 12/19] kernel: convert css_set.refcount from atomic_t to refcount_t Tejun Heo <tj@kernel.org> - 2017-03-07 20:50 +0100
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2017-03-06 21:00 +0100 |
| Subject | Re: [PATCH 12/19] kernel: convert css_set.refcount from atomic_t to refcount_t |
| Message-ID | <ti6Xw-4vE-17@gated-at.bofh.it> |
Hello,
On Mon, Feb 20, 2017 at 12:19:01PM +0200, Elena Reshetova wrote:
> @@ -134,10 +135,13 @@ static inline void put_css_set(struct css_set *cset)
> * can see it. Similar to atomic_dec_and_lock(), but for an
> * rwlock
> */
> - if (atomic_add_unless(&cset->refcount, -1, 1))
> + spin_lock_irqsave(&css_set_lock, flags);
> + if (refcount_read(&cset->refcount) != 1) {
> + WARN_ON(refcount_dec_and_test(&cset->refcount));
> + spin_unlock_irqrestore(&css_set_lock, flags);
> return;
> + }
This isn't an equivalent conversion and should have been mentioned in
the patch description. Hmm... and I'm not sure this is a good idea.
Can't we add the matching operation on refcount_t rather than adding
extra locking like this?
Thanks.
--
tejun
[toc] | [next] | [standalone]
| From | "Reshetova, Elena" <elena.reshetova@intel.com> |
|---|---|
| Date | 2017-03-07 20:20 +0100 |
| Message-ID | <tisOm-3ze-23@gated-at.bofh.it> |
| In reply to | #1593680 |
> Hello,
>
> On Mon, Feb 20, 2017 at 12:19:01PM +0200, Elena Reshetova wrote:
> > @@ -134,10 +135,13 @@ static inline void put_css_set(struct css_set *cset)
> > * can see it. Similar to atomic_dec_and_lock(), but for an
> > * rwlock
> > */
> > - if (atomic_add_unless(&cset->refcount, -1, 1))
> > + spin_lock_irqsave(&css_set_lock, flags);
> > + if (refcount_read(&cset->refcount) != 1) {
> > + WARN_ON(refcount_dec_and_test(&cset-
> >refcount));
> > + spin_unlock_irqrestore(&css_set_lock, flags);
> > return;
> > + }
>
> This isn't an equivalent conversion and should have been mentioned in
> the patch description. Hmm... and I'm not sure this is a good idea.
> Can't we add the matching operation on refcount_t rather than adding
> extra locking like this?
Oh, actually this is fault on our side: initially we didn't have a refcount_dec_not_one() interface and we had to be creative in converting cases like this, but now the interface is present, but we actually forgot to convert this particular case.
So, the above change should be:
- if (atomic_add_unless(&cset->refcount, -1, 1))
+ if (refcount_dec_not_one(&cset->refcount))
Do you want me to resend or could you modify the patch while applying?
Best Regards,
Elena.
>
> Thanks.
>
> --
> tejun
[toc] | [prev] | [next] | [standalone]
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2017-03-07 20:50 +0100 |
| Message-ID | <tithn-3Jt-19@gated-at.bofh.it> |
| In reply to | #1594558 |
Hello, On Tue, Mar 07, 2017 at 07:12:51PM +0000, Reshetova, Elena wrote: > Do you want me to resend or could you modify the patch while applying? Can you please send the updated patch? Thanks! -- tejun
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web