Skip to contentSkip to conversation

ksm questions

DISCUSSION Ni zhan Chen 2 participants 8 messages Oct 24, 2012 Memory management

lore
Share & tools
lore
#0 lore raw

Hi all,

I have some questions about ksm.

1) khugepaged default nice value is 19, but ksmd default nice value is 5, why this big different?
2) why ksm doesn't support pagecache and tmpfs now? What's the bottleneck?
3) ksm kernel doc said that "KSM only merges anonymous(private) pages, never pagecache(file) pages". But where judege it should be private?
4) ksm kernel doc said that "To avoid the instability and the resulting false negatives to be permanent, KSM re-initializes the unstable tree root node to an empty tree, at every KSM pass." But I can't find where re-initializes the unstable tree, could you explain me?

Thanks in advance. :-)

Regards,
Chen

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 8 lines · Ni zhan Chen

Hi all,

I have some questions about ksm.

1) khugepaged default nice value is 19, but ksmd default nice value is 5, why this big different?
2) why ksm doesn't support pagecache and tmpfs now? What's the bottleneck?
3) ksm kernel doc said that "KSM only merges anonymous(private) pages, never pagecache(file) pages". But where judege it should be private?
4) ksm kernel doc said that "To avoid the instability and the resulting false negatives to be permanent, KSM re-initializes the unstable tree root node to an empty tree, at every KSM pass." But I can't find where re-initializes the unstable tree, could you explain me?

in scan_get_next_rmap_item(), if (slot == &ksm_mm_head) then we do root_unstable_tree = RB_ROOT; this will result in root_unstable_tree being empty.

Quoted 6 lines

Thanks in advance. :-)

Regards,
Chen

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 5 lines · Izik Eidus
Quoted 4 lines · Ni zhan Chen

Hi all,

I have some questions about ksm.

Quoted 7 lines
Quoted 4 lines

1) khugepaged default nice value is 19, but ksmd default nice value is 5, why this big different?
2) why ksm doesn't support pagecache and tmpfs now? What's the bottleneck?
3) ksm kernel doc said that "KSM only merges anonymous(private) pages, never pagecache(file) pages". But where judege it should be private?
4) ksm kernel doc said that "To avoid the instability and the resulting false negatives to be permanent, KSM re-initializes the unstable tree root node to an empty tree, at every KSM pass." But I can't find where re-initializes the unstable tree, could you explain me?

in scan_get_next_rmap_item(), if (slot == &ksm_mm_head) then we do root_unstable_tree = RB_ROOT; this will result in root_unstable_tree being empty.

thanks Izik, what about the other three questions?

Quoted 9 lines
Quoted 7 lines

Thanks in advance. :-)

Regards,
Chen

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 12 lines · Ni zhan Chen
Quoted 11 lines · Izik Eidus
Quoted 8 lines · Ni zhan Chen

Hi all,

I have some questions about ksm.

1) khugepaged default nice value is 19, but ksmd default nice value is 5, why this big different?
2) why ksm doesn't support pagecache and tmpfs now? What's the bottleneck?
3) ksm kernel doc said that "KSM only merges anonymous(private) pages, never pagecache(file) pages". But where judege it should be private?
4) ksm kernel doc said that "To avoid the instability and the resulting false negatives to be permanent, KSM re-initializes the unstable tree root node to an empty tree, at every KSM pass." But I can't find where re-initializes the unstable tree, could you explain me?

Quoted 3 lines
Quoted 1 line

in scan_get_next_rmap_item(), if (slot == &ksm_mm_head) then we do root_unstable_tree = RB_ROOT; this will result in root_unstable_tree being empty.

thanks Izik, what about the other three questions?

Question number 2 is beacuse it is forced to work with anonymous pages, about question 3 - I will have to remember why from the very begining I wrote it to support only anonymous pages (few years have been passed), maybe Andrea/Huge have it more hot in their heads?

Quoted 11 lines
Quoted 10 lines
Quoted 8 lines

Thanks in advance. :-)

Regards,
Chen

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw
Quoted 13 lines · Izik Eidus
Quoted 12 lines · Ni zhan Chen
Quoted 11 lines · Izik Eidus
Quoted 8 lines · Ni zhan Chen

Hi all,

I have some questions about ksm.

1) khugepaged default nice value is 19, but ksmd default nice value is 5, why this big different?
2) why ksm doesn't support pagecache and tmpfs now? What's the bottleneck?
3) ksm kernel doc said that "KSM only merges anonymous(private) pages, never pagecache(file) pages". But where judege it should be private?
4) ksm kernel doc said that "To avoid the instability and the resulting false negatives to be permanent, KSM re-initializes the unstable tree root node to an empty tree, at every KSM pass." But I can't find where re-initializes the unstable tree, could you explain me?

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

in scan_get_next_rmap_item(), if (slot == &ksm_mm_head) then we do root_unstable_tree = RB_ROOT; this will result in root_unstable_tree being empty.

thanks Izik, what about the other three questions?

Question number 2 is beacuse it is forced to work with anonymous pages, about question 3 - I will have to remember why from the very begining I wrote it to support only anonymous pages (few years have been passed), maybe Andrea/Huge have it more hot in their heads?

The initialize goal of design ksm is for virtualization, but now it also can be used for other apps. So can it also support tmpfs or pagecache in the future?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 10 lines
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines

Thanks in advance. :-)

Regards,
Chen

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#5 lore raw
Quoted 14 lines · Ni zhan Chen
Quoted 13 lines · Izik Eidus
Quoted 12 lines · Ni zhan Chen
Quoted 11 lines · Izik Eidus
Quoted 8 lines · Ni zhan Chen

Hi all,

I have some questions about ksm.

1) khugepaged default nice value is 19, but ksmd default nice value is 5, why this big different?
2) why ksm doesn't support pagecache and tmpfs now? What's the bottleneck?
3) ksm kernel doc said that "KSM only merges anonymous(private) pages, never pagecache(file) pages". But where judege it should be private?
4) ksm kernel doc said that "To avoid the instability and the resulting false negatives to be permanent, KSM re-initializes the unstable tree root node to an empty tree, at every KSM pass." But I can't find where re-initializes the unstable tree, could you explain me?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

in scan_get_next_rmap_item(), if (slot == &ksm_mm_head) then we do root_unstable_tree = RB_ROOT; this will result in root_unstable_tree being empty.

thanks Izik, what about the other three questions?

Question number 2 is beacuse it is forced to work with anonymous pages, about question 3 - I will have to remember why from the very begining I wrote it to support only anonymous pages (few years have been passed), maybe Andrea/Huge have it more hot in their heads?

The initialize goal of design ksm is for virtualization, but now it also can be used for other apps. So can it also support tmpfs or pagecache in the future?

Talking from far memory, I remember it was easier/cleaner to only support anonymous pages, until Andrea/Huge wont remind us why I cant answer this (Maybe later I will have some time to read a little bit the code again and to remember what is going on in linux VM...)

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Thanks in advance. :-)

Quoted 9 lines
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Regards,
Chen

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#6 lore raw
In reply to Izik Eidus
Quoted 5 lines · Izik Eidus
Quoted 4 lines · Ni zhan Chen

Hi all,

I have some questions about ksm.

Quoted 7 lines
Quoted 4 lines

1) khugepaged default nice value is 19, but ksmd default nice value is 5, why this big different?
2) why ksm doesn't support pagecache and tmpfs now? What's the bottleneck?
3) ksm kernel doc said that "KSM only merges anonymous(private) pages, never pagecache(file) pages". But where judege it should be private?
4) ksm kernel doc said that "To avoid the instability and the resulting false negatives to be permanent, KSM re-initializes the unstable tree root node to an empty tree, at every KSM pass." But I can't find where re-initializes the unstable tree, could you explain me?

in scan_get_next_rmap_item(), if (slot == &ksm_mm_head) then we do root_unstable_tree = RB_ROOT; this will result in root_unstable_tree being empty.

Hi Izik,

Another four questions, thank for your patience and excellent codes. :-)

1) Why judge if(page->mapping != expected_mapping) in function get_ksm_page called twice? And it also call put_page(page) in the second time, when this put_page associated get_page(page) is called?
2)
in function scan_get_next_rmap_item,
if (PageAnon(*page)) ||

    page_trans_compound_anon(*page)) {
    flush_anon_page(vma, *page, ksm_scan.address);
    flush_dcache_page(*page);
    rmap_item = get_next_rmap_item(slot,

????????????????????
why call flush_dcache_page here? in kernel doc Documentation/cachetlb.txt, it said that "Any time the kernel writes to a page cache page, _OR_ the kernel is about to read from a page cache page and user space shared/writable mappings of this page potentially exist, this routine is called", it is used for flush page cache related cpu cache, but ksmd only scan anonymous page.
3) in function remove_rmap_item_from_tree, how to understand formula age = (unsigned char) (ksm_scan.seqr - rmap_item->address); why need aging?
4) in function page_volatile_show, how to understand ksm_pages_volatile = ksm_rmap_items - ksm_pages_shared - ksm_pages_sharing - ksm_pages_unshared; I mean that how this formula can figure out "how many pages changing too fast to be placed in a tree"?

Regards,
Chen

Quoted 9 lines
Quoted 7 lines

Thanks in advance. :-)

Regards,
Chen

#7 lore raw
In reply to Izik Eidus
Quoted 5 lines · Izik Eidus
Quoted 4 lines · Ni zhan Chen

Hi all,

I have some questions about ksm.

Quoted 7 lines
Quoted 4 lines

1) khugepaged default nice value is 19, but ksmd default nice value is 5, why this big different?
2) why ksm doesn't support pagecache and tmpfs now? What's the bottleneck?
3) ksm kernel doc said that "KSM only merges anonymous(private) pages, never pagecache(file) pages". But where judege it should be private?
4) ksm kernel doc said that "To avoid the instability and the resulting false negatives to be permanent, KSM re-initializes the unstable tree root node to an empty tree, at every KSM pass." But I can't find where re-initializes the unstable tree, could you explain me?

in scan_get_next_rmap_item(), if (slot == &ksm_mm_head) then we do root_unstable_tree = RB_ROOT; this will result in root_unstable_tree being empty.

Hi Izik,

Another four questions, thank for your patience and excellent codes. :-)

1) Why judge if(page->mapping != expected_mapping) in function get_ksm_page called twice? And it also call put_page(page) in the second time, when this put_page associated get_page(page) is called?
2)
in function scan_get_next_rmap_item,
if (PageAnon(*page)) ||

    page_trans_compound_anon(*page)) {
    flush_anon_page(vma, *page, ksm_scan.address);
    flush_dcache_page(*page);
    rmap_item = get_next_rmap_item(slot,

????????????????????
why call flush_dcache_page here? in kernel doc Documentation/cachetlb.txt, it said that "Any time the kernel writes to a page cache page, _OR_ the kernel is about to read from a page cache page and user space shared/writable mappings of this page potentially exist, this routine is called", it is used for flush page cache related cpu cache, but ksmd only scan anonymous page.
3) in function remove_rmap_item_from_tree, how to understand formula age = (unsigned char) (ksm_scan.seqr - rmap_item->address); why need aging?
4) in function page_volatile_show, how to understand ksm_pages_volatile = ksm_rmap_items - ksm_pages_shared - ksm_pages_sharing - ksm_pages_unshared; I mean that how this formula can figure out "how many pages changing too fast to be placed in a tree"?

Regards,
Chen

Quoted 9 lines
Quoted 7 lines

Thanks in advance. :-)

Regards,
Chen