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


Groups > linux.kernel > #1725395

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

From David Howells <dhowells@redhat.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return functions
Date 2017-09-02 01:00 +0200
Message-ID <ul34R-32l-15@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> <ul28O-2mX-29@gated-at.bofh.it>
Organization Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903

Show all headers | View raw


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();
	}

David

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