Re: [PATCH v2 2/3] acpi,memory-hotplug: introduce a mutex lock to protect the list in acpi_memory_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 19, 2012 at 6:03 AM,  <wency@xxxxxxxxxxxxxx> wrote:
> From: Wen Congyang <wency@xxxxxxxxxxxxxx>
>
> 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 <rientjes@xxxxxxxxxx>
> CC: Jiang Liu <liuj97@xxxxxxxxx>
> CC: Len Brown <len.brown@xxxxxxxxx>
> CC: Christoph Lameter <cl@xxxxxxxxx>
> Cc: Minchan Kim <minchan.kim@xxxxxxxxx>
> CC: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> CC: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
> CC: Yasuaki Ishimatsu <isimatu.yasuaki@xxxxxxxxxxxxxx>
> Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx>
> ---
>  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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]