Subject: Re: percpu storage allocator
To: YAMAMOTO Takashi <>
From: Andrew Doran <>
List: tech-kern
Date: 12/18/2007 16:01:33
On Mon, Nov 12, 2007 at 09:38:02PM +0000, Andrew Doran wrote:

> I think you could get away with not taking the rwlock in the cross call
> thread by deferring the lock to percpu_cpu_enlarge():
> 	if (pcc.pcc_data != NULL) {
> 		rw_enter(&percpu_swap_lock, RW_WRITER);
> 		/* Ensures old value of pcc_data is no longer used. */
> 		rw_exit(&percpu_swap_lock);
> 		kmem_free(pcc.pcc_data, pcc.pcc_size);
> 	}
> Threads traversing will see either old or new values, but in either case the
> pointer dereference will be safe. It may not be worth it; if so we should
> probably document that threads doing a traversal should be careful not to
> delay the xcall thread.

It occurred to me that won't work if setting an initial value for a new object.