Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758109Ab2JSTU3 (ORCPT ); Fri, 19 Oct 2012 15:20:29 -0400 Received: from mail-oa0-f46.google.com ([209.85.219.46]:36740 "EHLO mail-oa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757969Ab2JSTU1 (ORCPT ); Fri, 19 Oct 2012 15:20:27 -0400 MIME-Version: 1.0 In-Reply-To: <1350641040-19434-3-git-send-email-wency@cn.fujitsu.com> References: <1350641040-19434-1-git-send-email-wency@cn.fujitsu.com> <1350641040-19434-3-git-send-email-wency@cn.fujitsu.com> From: KOSAKI Motohiro Date: Fri, 19 Oct 2012 15:20:06 -0400 X-Google-Sender-Auth: jFQVhqmcLHtf0h0liR0cpqP4bvs Message-ID: Subject: Re: [PATCH v2 2/3] acpi,memory-hotplug: introduce a mutex lock to protect the list in acpi_memory_device To: wency@cn.fujitsu.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, liuj97@gmail.com, len.brown@intel.com, akpm@linux-foundation.org, isimatu.yasuaki@jp.fujitsu.com, muneda.takahiro@jp.fujitsu.com, David Rientjes , Christoph Lameter , Minchan Kim Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1790 Lines: 45 On Fri, Oct 19, 2012 at 6:03 AM, wrote: > From: Wen Congyang > > 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. > > CC: David Rientjes > CC: Jiang Liu > CC: Len Brown > CC: Christoph Lameter > Cc: Minchan Kim > CC: Andrew Morton > CC: KOSAKI Motohiro > CC: Yasuaki Ishimatsu > Signed-off-by: Wen Congyang > --- > drivers/acpi/acpi_memhotplug.c | 17 +++++++++++++++-- > 1 files changed, 15 insertions(+), 2 deletions(-) > > diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c > index 1e90e8f..8ff2976 100644 > --- a/drivers/acpi/acpi_memhotplug.c > +++ b/drivers/acpi/acpi_memhotplug.c > @@ -83,7 +83,8 @@ struct acpi_memory_info { > struct acpi_memory_device { > struct acpi_device * device; > unsigned int state; /* State of the memory device */ > - struct list_head res_list; > + struct mutex lock; > + struct list_head res_list; /* protected by lock */ > }; Please avoid grep unfriendly name. "lock" is too common. res_list_lock or list_lock are better IMHO. -- 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/