Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754858Ab1DOAYc (ORCPT ); Thu, 14 Apr 2011 20:24:32 -0400 Received: from mga01.intel.com ([192.55.52.88]:42037 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754749Ab1DOAYa (ORCPT ); Thu, 14 Apr 2011 20:24:30 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.64,214,1301900400"; d="scan'208";a="909793505" Message-ID: <4DA7903B.5030508@intel.com> Date: Fri, 15 Apr 2011 08:24:27 +0800 From: Huang Ying User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110303 Icedove/3.0.11 MIME-Version: 1.0 To: Mathieu Desnoyers CC: Len Brown , "linux-kernel@vger.kernel.org" , Andi Kleen , "Luck, Tony" , "linux-acpi@vger.kernel.org" , Andrew Morton Subject: Re: [PATCH -v3 3/4] lib, Make gen_pool memory allocator lockless References: <1302684835-14133-1-git-send-email-ying.huang@intel.com> <1302684835-14133-4-git-send-email-ying.huang@intel.com> <20110413210757.GA11683@Krystal> In-Reply-To: <20110413210757.GA11683@Krystal> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1099 Lines: 25 On 04/14/2011 05:07 AM, Mathieu Desnoyers wrote: > * Huang Ying (ying.huang@intel.com) wrote: > [...] >> + * rcu_read_lock and rcu_read_unlock is not used int gen_pool_alloc, >> + * gen_pool_free, gen_pool_avail and gen_pool_size etc, because chunks >> + * are only added into pool, not deleted from pool unless the pool >> + * itself is destroyed. If chunk will be deleted from pool, >> + * rcu_read_lock and rcu_read_unlock should be uses in these >> + * functions. > > So how do you protect between pool destruction and adding chunks into > the pool ? Because the pool itself will be freed when destruction, we need some mechanism outside of pool. For example, if gen_pool_add() is called via device file IOCTL, we must un-register the device file first, and destroy the pool after the last reference to device has gone. Best Regards, Huang Ying -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/