linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/hotplug: only free wait_table if it's allocated by vmalloc
@ 2013-03-22  9:54 Jianguo Wu
  2013-03-22 10:02 ` Tang Chen
  0 siblings, 1 reply; 5+ messages in thread
From: Jianguo Wu @ 2013-03-22  9:54 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Tang Chen, Wen Congyang, Liujiang, qiuxishi, linux-mm

zone->wait_table may be allocated from bootmem, it can not be freed.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: linux-mm@kvack.org
Signed-off-by: Jianguo Wu <wujianguo@huawei.com>
---
 mm/memory_hotplug.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 07b6263..91ed7cd 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1779,7 +1779,11 @@ void try_offline_node(int nid)
 	for (i = 0; i < MAX_NR_ZONES; i++) {
 		struct zone *zone = pgdat->node_zones + i;
 
-		if (zone->wait_table)
+		/*
+		 * wait_table may be allocated from boot memory,
+		 * here only free if it's allocated by vmalloc.
+		 */
+		if (is_vmalloc_addr(zone->wait_table))
 			vfree(zone->wait_table);
 	}
 
-- 
1.7.6.1


--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/hotplug: only free wait_table if it's allocated by vmalloc
  2013-03-22  9:54 [PATCH] mm/hotplug: only free wait_table if it's allocated by vmalloc Jianguo Wu
@ 2013-03-22 10:02 ` Tang Chen
  2013-03-25  1:15   ` Jiang Liu
  2013-03-25  1:26   ` Jianguo Wu
  0 siblings, 2 replies; 5+ messages in thread
From: Tang Chen @ 2013-03-22 10:02 UTC (permalink / raw)
  To: Jianguo Wu
  Cc: Andrew Morton, Wen Congyang, Liujiang, qiuxishi, linux-mm,
	Tang Chen

On 03/22/2013 05:54 PM, Jianguo Wu wrote:
> zone->wait_table may be allocated from bootmem, it can not be freed.
>
> Cc: Andrew Morton<akpm@linux-foundation.org>
> Cc: Wen Congyang<wency@cn.fujitsu.com>
> Cc: Tang Chen<tangchen@cn.fujitsu.com>
> Cc: Jiang Liu<jiang.liu@huawei.com>
> Cc: linux-mm@kvack.org
> Signed-off-by: Jianguo Wu<wujianguo@huawei.com>
> ---
>   mm/memory_hotplug.c |    6 +++++-
>   1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 07b6263..91ed7cd 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1779,7 +1779,11 @@ void try_offline_node(int nid)
>   	for (i = 0; i<  MAX_NR_ZONES; i++) {
>   		struct zone *zone = pgdat->node_zones + i;
>
> -		if (zone->wait_table)
> +		/*
> +		 * wait_table may be allocated from boot memory,
> +		 * here only free if it's allocated by vmalloc.
> +		 */
> +		if (is_vmalloc_addr(zone->wait_table))
>   			vfree(zone->wait_table);

Reviewed-by: Tang Chen <tangchen@cn.fujitsu.com>

FYI, I'm trying add a flag member into memblock to mark memory whose
life cycle is the same as a node. I think maybe this flag could be used
to free this kind of memory from bootmem.

Thanks. :)


>   	}
>

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/hotplug: only free wait_table if it's allocated by vmalloc
  2013-03-22 10:02 ` Tang Chen
@ 2013-03-25  1:15   ` Jiang Liu
  2013-03-25  3:20     ` Tang Chen
  2013-03-25  1:26   ` Jianguo Wu
  1 sibling, 1 reply; 5+ messages in thread
From: Jiang Liu @ 2013-03-25  1:15 UTC (permalink / raw)
  To: Tang Chen; +Cc: Jianguo Wu, Andrew Morton, Wen Congyang, qiuxishi, linux-mm

I have done a work to associate a tag with each memblock,
may be that could be reused.

On 2013-3-22 18:02, Tang Chen wrote:
> On 03/22/2013 05:54 PM, Jianguo Wu wrote:
>> zone->wait_table may be allocated from bootmem, it can not be freed.
>>
>> Cc: Andrew Morton<akpm@linux-foundation.org>
>> Cc: Wen Congyang<wency@cn.fujitsu.com>
>> Cc: Tang Chen<tangchen@cn.fujitsu.com>
>> Cc: Jiang Liu<jiang.liu@huawei.com>
>> Cc: linux-mm@kvack.org
>> Signed-off-by: Jianguo Wu<wujianguo@huawei.com>
>> ---
>>   mm/memory_hotplug.c |    6 +++++-
>>   1 files changed, 5 insertions(+), 1 deletions(-)
>>
>> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
>> index 07b6263..91ed7cd 100644
>> --- a/mm/memory_hotplug.c
>> +++ b/mm/memory_hotplug.c
>> @@ -1779,7 +1779,11 @@ void try_offline_node(int nid)
>>       for (i = 0; i<  MAX_NR_ZONES; i++) {
>>           struct zone *zone = pgdat->node_zones + i;
>>
>> -        if (zone->wait_table)
>> +        /*
>> +         * wait_table may be allocated from boot memory,
>> +         * here only free if it's allocated by vmalloc.
>> +         */
>> +        if (is_vmalloc_addr(zone->wait_table))
>>               vfree(zone->wait_table);
>
> Reviewed-by: Tang Chen <tangchen@cn.fujitsu.com>
>
> FYI, I'm trying add a flag member into memblock to mark memory whose
> life cycle is the same as a node. I think maybe this flag could be used
> to free this kind of memory from bootmem.
>
> Thanks. :)
>
>
>>       }
>>
>
>


--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/hotplug: only free wait_table if it's allocated by vmalloc
  2013-03-22 10:02 ` Tang Chen
  2013-03-25  1:15   ` Jiang Liu
@ 2013-03-25  1:26   ` Jianguo Wu
  1 sibling, 0 replies; 5+ messages in thread
From: Jianguo Wu @ 2013-03-25  1:26 UTC (permalink / raw)
  To: Tang Chen; +Cc: Andrew Morton, Wen Congyang, Liujiang, qiuxishi, linux-mm

On 2013/3/22 18:02, Tang Chen wrote:

> On 03/22/2013 05:54 PM, Jianguo Wu wrote:
>> zone->wait_table may be allocated from bootmem, it can not be freed.
>>
>> Cc: Andrew Morton<akpm@linux-foundation.org>
>> Cc: Wen Congyang<wency@cn.fujitsu.com>
>> Cc: Tang Chen<tangchen@cn.fujitsu.com>
>> Cc: Jiang Liu<jiang.liu@huawei.com>
>> Cc: linux-mm@kvack.org
>> Signed-off-by: Jianguo Wu<wujianguo@huawei.com>
>> ---
>>   mm/memory_hotplug.c |    6 +++++-
>>   1 files changed, 5 insertions(+), 1 deletions(-)
>>
>> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
>> index 07b6263..91ed7cd 100644
>> --- a/mm/memory_hotplug.c
>> +++ b/mm/memory_hotplug.c
>> @@ -1779,7 +1779,11 @@ void try_offline_node(int nid)
>>       for (i = 0; i<  MAX_NR_ZONES; i++) {
>>           struct zone *zone = pgdat->node_zones + i;
>>
>> -        if (zone->wait_table)
>> +        /*
>> +         * wait_table may be allocated from boot memory,
>> +         * here only free if it's allocated by vmalloc.
>> +         */
>> +        if (is_vmalloc_addr(zone->wait_table))
>>               vfree(zone->wait_table);
> 
> Reviewed-by: Tang Chen <tangchen@cn.fujitsu.com>
> 
> FYI, I'm trying add a flag member into memblock to mark memory whose
> life cycle is the same as a node. I think maybe this flag could be used
> to free this kind of memory from bootmem.

And only the bootmem is aligned to PAGE_SIZE, I think.

> 
> Thanks. :)
> 
> 
>>       }
>>
> 
> -- 
> 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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> 
> 



--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm/hotplug: only free wait_table if it's allocated by vmalloc
  2013-03-25  1:15   ` Jiang Liu
@ 2013-03-25  3:20     ` Tang Chen
  0 siblings, 0 replies; 5+ messages in thread
From: Tang Chen @ 2013-03-25  3:20 UTC (permalink / raw)
  To: Jiang Liu; +Cc: Jianguo Wu, Andrew Morton, Wen Congyang, qiuxishi, linux-mm

On 03/25/2013 09:15 AM, Jiang Liu wrote:
> I have done a work to associate a tag with each memblock,
> may be that could be reused.

Hi Liu,

Yes, the CONFIG_HAVE_MEMBLOCK_TAG patch, I saw that before. :)

And it may have the following difference,
1) It is a flag, not a tag, which means a range may have several
    different attributes.
2) Mark node-lify-cycle data, and put it on local node, and free
    it when hot-removing.
3) Mark and reserve movable memory, as you did. :)

I'll try to find as much code that can be reused as I can. :)

Thanks for reminding me this. :)

Thanks. :)

>
> On 2013-3-22 18:02, Tang Chen wrote:
>> On 03/22/2013 05:54 PM, Jianguo Wu wrote:
>>> zone->wait_table may be allocated from bootmem, it can not be freed.
>>>
>>> Cc: Andrew Morton<akpm@linux-foundation.org>
>>> Cc: Wen Congyang<wency@cn.fujitsu.com>
>>> Cc: Tang Chen<tangchen@cn.fujitsu.com>
>>> Cc: Jiang Liu<jiang.liu@huawei.com>
>>> Cc: linux-mm@kvack.org
>>> Signed-off-by: Jianguo Wu<wujianguo@huawei.com>
>>> ---
>>>    mm/memory_hotplug.c |    6 +++++-
>>>    1 files changed, 5 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
>>> index 07b6263..91ed7cd 100644
>>> --- a/mm/memory_hotplug.c
>>> +++ b/mm/memory_hotplug.c
>>> @@ -1779,7 +1779,11 @@ void try_offline_node(int nid)
>>>        for (i = 0; i<   MAX_NR_ZONES; i++) {
>>>            struct zone *zone = pgdat->node_zones + i;
>>>
>>> -        if (zone->wait_table)
>>> +        /*
>>> +         * wait_table may be allocated from boot memory,
>>> +         * here only free if it's allocated by vmalloc.
>>> +         */
>>> +        if (is_vmalloc_addr(zone->wait_table))
>>>                vfree(zone->wait_table);
>>
>> Reviewed-by: Tang Chen<tangchen@cn.fujitsu.com>
>>
>> FYI, I'm trying add a flag member into memblock to mark memory whose
>> life cycle is the same as a node. I think maybe this flag could be used
>> to free this kind of memory from bootmem.
>>
>> Thanks. :)
>>
>>
>>>        }
>>>
>>
>>
>
>
>

--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-25  3:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-22  9:54 [PATCH] mm/hotplug: only free wait_table if it's allocated by vmalloc Jianguo Wu
2013-03-22 10:02 ` Tang Chen
2013-03-25  1:15   ` Jiang Liu
2013-03-25  3:20     ` Tang Chen
2013-03-25  1:26   ` Jianguo Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).