From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752478Ab1LLP2G (ORCPT ); Mon, 12 Dec 2011 10:28:06 -0500 Received: from cantor2.suse.de ([195.135.220.15]:57708 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750790Ab1LLP2B (ORCPT ); Mon, 12 Dec 2011 10:28:01 -0500 Date: Mon, 12 Dec 2011 07:24:41 -0800 From: Greg KH To: Peter Zijlstra Cc: Ming Lei , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, ostrikov@nvidia.com, adobriyan@gmail.com, eric.dumazet@gmail.com, mingo@elte.hu, Oliver Neukum Subject: Re: [PATCH 3/3] kref: Remove the memory barriers Message-ID: <20111212152441.GA7827@suse.de> References: <1323529084.16764.5.camel@twins> <1323546551.2822.14.camel@laptop> <1323607627.16764.13.camel@twins> <1323617738.16764.21.camel@twins> <1323636148.16764.44.camel@twins> <1323680157.16764.47.camel@twins> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1323680157.16764.47.camel@twins> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 12, 2011 at 09:55:57AM +0100, Peter Zijlstra wrote: > On Mon, 2011-12-12 at 11:48 +0800, Ming Lei wrote: > > We can't assume any lock about kref usage, because kref is often used > > in lockless scenario. > > Then you're doing it wrong, seriously. > > kref in lockless scenarios simply doesn't work, you need rcu (or another > means to stabilize storage) and atomic_inc_not_zero() as well as means > to validate your object after the lookup. I agree, and I'll apply your patches later today, thanks for doing them. greg k-h