Skip to contentSkip to conversation

thp: support split page table lock

PATCH Daniel J Blueman 2 participants 2 messages Sep 9, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Quoted 11 lines · Naoya Horiguchi

Hi Alex,

Quoted 8 lines · Alex Thorlton
Quoted 7 lines · Naoya Horiguchi

Thp related code also uses per process mm->page_table_lock now. So making it fine-grained can provide better performance.

This patch makes thp support split page table lock by using page->ptl of the pages storing "pmd_trans_huge" pmds.

Some functions like pmd_trans_huge_lock() and

page_check_address_pmd()

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

are expected by their caller to pass back the pointer of ptl, so this patch adds to those functions new arguments for that. Rather than

that,

Quoted 11 lines
Quoted 9 lines
Quoted 5 lines

this patch gives only straightforward replacement.

ChangeLog v3:
- fixed argument of huge_pmd_lockptr() in copy_huge_pmd()
- added missing declaration of ptl in do_huge_pmd_anonymous_page()

I've applied these and tested them using the same tests program that I used when I was working on the same issue, and I'm running into some bugs. Here's a stack trace:

Thank you for helping testing. This bug is new to me.

With 3.11, this patch series and CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS, I consistently hit the same failure when exiting one of my stress-testers [1] when using eg 24 cores.

Doesn't happen with 8 cores, so likely needs enough virtual memory to use multiple split locks. Otherwise, this is very promising work!

[1] http://quora.org/2013/fft3d.c

Signature · 8 lines
Daniel J Blueman
Principal Software Engineer, Numascale

--
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 26 lines · Daniel J Blueman
Quoted 11 lines · Naoya Horiguchi

Hi Alex,

Quoted 8 lines · Alex Thorlton
Quoted 7 lines · Naoya Horiguchi

Thp related code also uses per process mm->page_table_lock now. So making it fine-grained can provide better performance.

This patch makes thp support split page table lock by using page->ptl of the pages storing "pmd_trans_huge" pmds.

Some functions like pmd_trans_huge_lock() and

page_check_address_pmd()

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

are expected by their caller to pass back the pointer of ptl, so this patch adds to those functions new arguments for that. Rather than

that,

Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

this patch gives only straightforward replacement.

ChangeLog v3:
- fixed argument of huge_pmd_lockptr() in copy_huge_pmd()
- added missing declaration of ptl in do_huge_pmd_anonymous_page()

I've applied these and tested them using the same tests program that I used when I was working on the same issue, and I'm running into some bugs. Here's a stack trace:

Quoted 8 lines
Quoted 1 line

Thank you for helping testing. This bug is new to me.

With 3.11, this patch series and CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS, I consistently hit the same failure when exiting one of my stress-testers [1] when using eg 24 cores.

Doesn't happen with 8 cores, so likely needs enough virtual memory to use multiple split locks. Otherwise, this is very promising work!

Daniel,

Hillf Danton ([email protected]) suggested putting the big page_table_lock back into the two functions seen below. I re-tested with this change and it seems to resolve the issue.

- Alex

mm/pgtable-generic.c Sat Sep 7 15:20:28 2013 renamed from mm/pgtable-generic.c Sat Sep 7 15:17:52 2013 +4 -0
@@ -127,12 +127,14 @@ void pmdp_splitting_flush(struct vm_area
 void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
                                pgtable_t pgtable)
 {
+       spin_lock(&mm->page_table_lock);
        /* FIFO */
        if (!mm->pmd_huge_pte)
                INIT_LIST_HEAD(&pgtable->lru);
        else
                list_add(&pgtable->lru, &mm->pmd_huge_pte->lru);
        mm->pmd_huge_pte = pgtable;
+       spin_unlock(&mm->page_table_lock);
 }
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
 #endif
@@ -144,6 +146,7 @@ pgtable_t pgtable_trans_huge_withdraw(st
 {
        pgtable_t pgtable;
 
+       spin_lock(&mm->page_table_lock);
        /* FIFO */
        pgtable = mm->pmd_huge_pte;
        if (list_empty(&pgtable->lru))
@@ -153,6 +156,7 @@ pgtable_t pgtable_trans_huge_withdraw(st
                                              struct page, lru);
                list_del(&pgtable->lru);
        }
+       spin_unlock(&mm->page_table_lock);
        return pgtable;
 }
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */

--

--
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>