* [RFC] mm: why vfree() do not free page table memory?
@ 2017-12-29 8:58 Xishi Qiu
2018-01-11 1:27 ` Xishi Qiu
2018-01-17 9:16 ` Vlastimil Babka
0 siblings, 2 replies; 6+ messages in thread
From: Xishi Qiu @ 2017-12-29 8:58 UTC (permalink / raw)
To: Michal Hocko, Vlastimil Babka, Mel Gorman
Cc: LKML, Linux MM, Xishi Qiu, Wujiangtao (A)
When calling vfree(), it calls unmap_vmap_area() to clear page table,
but do not free the memory of page table, why? just for performance?
If a driver use vmalloc() and vfree() frequently, we will lost much
page table memory, maybe oom later.
Thanks,
Xishi Qiu
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC] mm: why vfree() do not free page table memory?
2017-12-29 8:58 [RFC] mm: why vfree() do not free page table memory? Xishi Qiu
@ 2018-01-11 1:27 ` Xishi Qiu
2018-01-17 9:16 ` Vlastimil Babka
1 sibling, 0 replies; 6+ messages in thread
From: Xishi Qiu @ 2018-01-11 1:27 UTC (permalink / raw)
To: Xishi Qiu
Cc: Michal Hocko, Vlastimil Babka, Mel Gorman, LKML, Linux MM,
Wujiangtao (A), Qiuchangqi (Lion, Euler Dept )
On 2017/12/29 16:58, Xishi Qiu wrote:
> When calling vfree(), it calls unmap_vmap_area() to clear page table,
> but do not free the memory of page table, why? just for performance?
>
> If a driver use vmalloc() and vfree() frequently, we will lost much
> page table memory, maybe oom later.
>
> Thanks,
> Xishi Qiu
>
ping
>
> .
>
--
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] 6+ messages in thread
* Re: [RFC] mm: why vfree() do not free page table memory?
2017-12-29 8:58 [RFC] mm: why vfree() do not free page table memory? Xishi Qiu
2018-01-11 1:27 ` Xishi Qiu
@ 2018-01-17 9:16 ` Vlastimil Babka
2018-01-17 9:48 ` Xishi Qiu
1 sibling, 1 reply; 6+ messages in thread
From: Vlastimil Babka @ 2018-01-17 9:16 UTC (permalink / raw)
To: Xishi Qiu, Michal Hocko, Mel Gorman; +Cc: LKML, Linux MM, Wujiangtao (A)
On 12/29/2017 09:58 AM, Xishi Qiu wrote:
> When calling vfree(), it calls unmap_vmap_area() to clear page table,
> but do not free the memory of page table, why? just for performance?
I guess it's expected that the free virtual range and associated page
tables it might be reused later.
> If a driver use vmalloc() and vfree() frequently, we will lost much
> page table memory, maybe oom later.
If it's reused, then not really.
Did you notice an actual issue, or is this just theoretical concern.
> Thanks,
> Xishi Qiu
>
--
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] 6+ messages in thread
* Re: [RFC] mm: why vfree() do not free page table memory?
2018-01-17 9:16 ` Vlastimil Babka
@ 2018-01-17 9:48 ` Xishi Qiu
2018-01-17 13:14 ` Vlastimil Babka
2018-01-17 14:17 ` Matthew Wilcox
0 siblings, 2 replies; 6+ messages in thread
From: Xishi Qiu @ 2018-01-17 9:48 UTC (permalink / raw)
To: Vlastimil Babka; +Cc: Michal Hocko, Mel Gorman, LKML, Linux MM, Wujiangtao (A)
On 2018/1/17 17:16, Vlastimil Babka wrote:
> On 12/29/2017 09:58 AM, Xishi Qiu wrote:
>> When calling vfree(), it calls unmap_vmap_area() to clear page table,
>> but do not free the memory of page table, why? just for performance?
>
> I guess it's expected that the free virtual range and associated page
> tables it might be reused later.
>
Hi Vlastimili 1/4 ?
If use vmalloc/vfree different size, then there will be some hols during
VMALLOC_START to VMALLOC_END, and this holes takes page table memory, right?
>> If a driver use vmalloc() and vfree() frequently, we will lost much
>> page table memory, maybe oom later.
>
> If it's reused, then not really.
>
> Did you notice an actual issue, or is this just theoretical concern.
>
Yes, we have this problem on our production line.
I find the page table memory takes 200-300M.
Thanks,
Xishi Qiu
>> Thanks,
>> Xishi Qiu
>>
>
>
> .
>
--
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] 6+ messages in thread
* Re: [RFC] mm: why vfree() do not free page table memory?
2018-01-17 9:48 ` Xishi Qiu
@ 2018-01-17 13:14 ` Vlastimil Babka
2018-01-17 14:17 ` Matthew Wilcox
1 sibling, 0 replies; 6+ messages in thread
From: Vlastimil Babka @ 2018-01-17 13:14 UTC (permalink / raw)
To: Xishi Qiu; +Cc: Michal Hocko, Mel Gorman, LKML, Linux MM, Wujiangtao (A)
On 01/17/2018 10:48 AM, Xishi Qiu wrote:
> On 2018/1/17 17:16, Vlastimil Babka wrote:
>
>> On 12/29/2017 09:58 AM, Xishi Qiu wrote:
>>> When calling vfree(), it calls unmap_vmap_area() to clear page table,
>>> but do not free the memory of page table, why? just for performance?
>>
>> I guess it's expected that the free virtual range and associated page
>> tables it might be reused later.
>>
>
> Hi Vlastimili 1/4 ?
>
> If use vmalloc/vfree different size, then there will be some hols during
> VMALLOC_START to VMALLOC_END, and this holes takes page table memory, right?
Possibly. But to free a page table page, there has to be contiguous
aligned 2MB hole.
>>> If a driver use vmalloc() and vfree() frequently, we will lost much
>>> page table memory, maybe oom later.
>>
>> If it's reused, then not really.
>>
>> Did you notice an actual issue, or is this just theoretical concern.
>>
>
> Yes, we have this problem on our production line.
> I find the page table memory takes 200-300M.
Well, can you verify that it's really due to vmalloc holes? And that the
holes are there because of an unfortunate sequence of vmalloc/vfree, and
not due to some bug in vmalloc failing to reuse freed areas properly?
And do the holes contain enough 2MB aligned ranges to make it possible
to free the page tables?
Vlastimil
> Thanks,
> Xishi Qiu
>
>>> Thanks,
>>> Xishi Qiu
>>>
>>
>>
>> .
>>
>
>
>
--
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] 6+ messages in thread
* Re: [RFC] mm: why vfree() do not free page table memory?
2018-01-17 9:48 ` Xishi Qiu
2018-01-17 13:14 ` Vlastimil Babka
@ 2018-01-17 14:17 ` Matthew Wilcox
1 sibling, 0 replies; 6+ messages in thread
From: Matthew Wilcox @ 2018-01-17 14:17 UTC (permalink / raw)
To: Xishi Qiu
Cc: Vlastimil Babka, Michal Hocko, Mel Gorman, LKML, Linux MM,
Wujiangtao (A)
On Wed, Jan 17, 2018 at 05:48:57PM +0800, Xishi Qiu wrote:
> > Did you notice an actual issue, or is this just theoretical concern.
>
> Yes, we have this problem on our production line.
> I find the page table memory takes 200-300M.
200MB? That's mapping 800GB of virtual address space. That must be
quite the module you're loading there ...
--
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] 6+ messages in thread
end of thread, other threads:[~2018-01-17 14:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-29 8:58 [RFC] mm: why vfree() do not free page table memory? Xishi Qiu
2018-01-11 1:27 ` Xishi Qiu
2018-01-17 9:16 ` Vlastimil Babka
2018-01-17 9:48 ` Xishi Qiu
2018-01-17 13:14 ` Vlastimil Babka
2018-01-17 14:17 ` Matthew Wilcox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox