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


Groups > linux.kernel > #1725889

Re: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return functions

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return functions
Date 2017-09-04 09:40 +0200
Message-ID <ulU9b-2BO-5@gated-at.bofh.it> (permalink)
References (1 earlier) <ukXiN-7Ew-1@gated-at.bofh.it> <ukWmK-71s-3@gated-at.bofh.it> <ukWmL-71s-37@gated-at.bofh.it> <ul1w6-288-11@gated-at.bofh.it> <ul34R-32l-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Sep 01, 2017 at 11:51:53PM +0100, David Howells wrote:
> Peter Zijlstra <peterz@infradead.org> wrote:
> 
> > 	if (obj) {
> > 	  /* use obj */
> > 	  refcount_dec(&obj->refs); /* should never hit 0 */
> > 	}
> 
> You've missed a bit: We need to tell the gc to run when we reduce the refcount
> to 1:
> 
> 	if (obj) {
> 		...
> 		if (refcount_dec_return(&obj->refs) == 1)
> 			schedule_gc();
> 	}

Ah, so that isn't fundamental to having a GC. But yes if that's your
requirement, then this makes sense.

Please clarify in the Changelog.

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


Thread

[RFC PATCH 02/11] refcount: Implement inc/decrement-and-return  functions David Howells <dhowells@redhat.com> - 2017-09-01 17:50 +0200
  Re: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return  functions Peter Zijlstra <peterz@infradead.org> - 2017-09-01 18:50 +0200
    Re: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return functions David Howells <dhowells@redhat.com> - 2017-09-01 23:20 +0200
      Re: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return  functions Peter Zijlstra <peterz@infradead.org> - 2017-09-02 00:00 +0200
        Re: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return  functions Peter Zijlstra <peterz@infradead.org> - 2017-09-02 00:10 +0200
        Re: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return functions David Howells <dhowells@redhat.com> - 2017-09-02 01:00 +0200
          Re: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return  functions Peter Zijlstra <peterz@infradead.org> - 2017-09-04 09:40 +0200
  Re: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return  functions Christoph Hellwig <hch@infradead.org> - 2017-09-04 17:40 +0200
    Re: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return functions David Howells <dhowells@redhat.com> - 2017-09-04 18:10 +0200
      Re: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return  functions Christoph Hellwig <hch@infradead.org> - 2017-09-05 08:50 +0200

csiph-web