Re: [RFC v8 PATCH 04/20] memory-hotplug: offline and remove memorywhen removing the memory device

From: Andrew Morton
Date: Fri Aug 31 2012 - 16:55:25 EST


On Tue, 28 Aug 2012 18:00:11 +0800
wency@xxxxxxxxxxxxxx wrote:

> +int remove_memory(int nid, u64 start, u64 size)
> +{
> + int ret = -EBUSY;
> + lock_memory_hotplug();
> + /*
> + * The memory might become online by other task, even if you offine it.
> + * So we check whether the cpu has been onlined or not.

I think you meant "memory", not "cpu".

Actually, "check whether any part of this memory range has been
onlined" would be better. If that is accurate ;)

> + */
> + if (!is_memblk_offline(start, size)) {
> + pr_warn("memory removing [mem %#010llx-%#010llx] failed, "
> + "because the memmory range is online\n",
> + start, start + size);
> + ret = -EAGAIN;
> + }
> +
> + unlock_memory_hotplug();
> + return ret;
> +
> +}
> +EXPORT_SYMBOL_GPL(remove_memory);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/