lkml.org 
[lkml]   [2015]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: node-hotplug: is memset 0 safe in try_offline_node()?
Hi Xishi,
On 03/04/2015 10:52 AM, Xishi Qiu wrote:

> On 2015/3/4 10:22, Xishi Qiu wrote:
>
>> On 2015/3/3 18:20, Gu Zheng wrote:
>>
>>> Hi Xishi,
>>> On 03/03/2015 11:30 AM, Xishi Qiu wrote:
>>>
>>>> When hot-remove a numa node, we will clear pgdat,
>>>> but is memset 0 safe in try_offline_node()?
>>>
>>> It is not safe here. In fact, this is a temporary solution here.
>>> As you know, pgdat is accessed lock-less now, so protection
>>> mechanism (RCU?) is needed to make it completely safe here,
>>> but it seems a bit over-kill.
>>>
>
> Hi Gu,
>
> Can we just remove "memset(pgdat, 0, sizeof(*pgdat));" ?
> I find this will be fine in the stress test except the warning
> when hot-add memory.

As you see, it will trigger the warning in free_area_init_node().
Could you try the following patch? It will reset the pgdat before reuse it.

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 1778628..0717649 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1092,6 +1092,9 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start)
return NULL;

arch_refresh_nodedata(nid, pgdat);
+ } else {
+ /* Reset the pgdat to reuse */
+ memset(pgdat, 0, sizeof(*pgdat));
}

/* we can use NODE_DATA(nid) from here */
@@ -2021,15 +2024,6 @@ void try_offline_node(int nid)

/* notify that the node is down */
call_node_notify(NODE_DOWN, (void *)(long)nid);
-
- /*
- * Since there is no way to guarentee the address of pgdat/zone is not
- * on stack of any kernel threads or used by other kernel objects
- * without reference counting or other symchronizing method, do not
- * reset node_data and free pgdat here. Just reset it to 0 and reuse
- * the memory when the node is online again.
- */
- memset(pgdat, 0, sizeof(*pgdat));
}
EXPORT_SYMBOL(try_offline_node);

>
> Thanks,
> Xishi Qiu
>
> --
> 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/
> .
>




\
 
 \ /
  Last update: 2015-03-04 05:21    [W:0.087 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site