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

David Howells dhowells at redhat.com
Fri Sep 1 15:51:53 PDT 2017


Peter Zijlstra <peterz at 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



More information about the linux-afs mailing list