From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx172.postini.com [74.125.245.172]) by kanga.kvack.org (Postfix) with SMTP id 403E36B005D for ; Mon, 12 Nov 2012 16:08:54 -0500 (EST) Message-ID: <1352754038.12509.16.camel@misato.fc.hp.com> Subject: Re: [Patch v4 1/7] acpi,memory-hotplug: introduce a mutex lock to protect the list in acpi_memory_device From: Toshi Kani Date: Mon, 12 Nov 2012 14:00:38 -0700 In-Reply-To: <1352372693-32411-2-git-send-email-wency@cn.fujitsu.com> References: <1352372693-32411-1-git-send-email-wency@cn.fujitsu.com> <1352372693-32411-2-git-send-email-wency@cn.fujitsu.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Wen Congyang Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-acpi@vger.kernel.org, Len Brown , "Rafael J. Wysocki" , Andrew Morton , Yasuaki Ishimatsu , Lai Jiangshan , Jiang Liu , KOSAKI Motohiro , Minchan Kim , Mel Gorman , David Rientjes , Konrad Rzeszutek Wilk , Jiang Liu , Benjamin Herrenschmidt , Paul Mackerras , Christoph Lameter On Thu, 2012-11-08 at 19:04 +0800, Wen Congyang wrote: > The memory device can be removed by 2 ways: > 1. send eject request by SCI > 2. echo 1 >/sys/bus/pci/devices/PNP0C80:XX/eject > > This 2 events may happen at the same time, so we may touch > acpi_memory_device.res_list at the same time. This patch > introduce a lock to protect this list. Hi Wen, This race condition is not unique in memory hot-remove as the sysfs eject interface is created for all objects with _EJ0. For CPU hot-remove, I addressed this race condition by making the notify handler to run the hot-remove operation on kacpi_hotplug_wq by calling acpi_os_hotplug_execute(). This serializes the hot-remove operations among the two events since the sysfs eject also runs on kacpi_hotplug_wq. This way is much simpler and is easy to maintain, although it does not allow both operations to run simultaneously (which I do not think we need). Can it be used for memory hot-remove as well? Thanks, -Toshi -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org