: transparent hugepage check condition missed
Subsystems (2)
PATCH 1/1 : transparent hugepage check condition missed
For the transparent hugepage module still does not support tmpfs and cache,the check condition should always be checked to make sure that it only affect the anonymous maps, the original check condition missed this, this patch is to fix this. Otherwise,the hugepage may affect the file-backed maps, then the cache for the small-size pages will be unuseful, and till now there is still no implementation for hugepage's cache.
--- mm/memory.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
mm/memory.c +2 -1
@@ -3475,7 +3475,8 @@ int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma,if (pmd_trans_huge (orig_pmd)) {if (flags &FAULT_FLAG_WRITE && !pmd_write (orig_pmd) && - !pmd_trans_splitting (orig_pmd)) + !pmd_trans_splitting (orig_pmd) && + !vma->vm_ops)return do_huge_pmd_wp_page (mm, vma, address, pmd, orig_pmd);return 0 ;
Signature · 8 lines
1.7.3.4 -- 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/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 18 lines · Guanjun He
For the transparent hugepage module still does not support tmpfs and cache,the check condition should always be checked to make sure that it only affect the anonymous maps, the original check condition missed this, this patch is to fix this. Otherwise,the hugepage may affect the file-backed maps, then the cache for the small-size pages will be unuseful, and till now there is still no implementation for hugepage's cache.
Signed-off-by Guanjun He <[email protected]>--- mm/memory.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)mm/memory.c +0
-0
mm/memory.c int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, · line 3482
Quoted 9 lines
mm/memory.c +2
-1@@ -3475,7 +3475,8 @@ int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma,if (pmd_trans_huge (orig_pmd)) {if (flags &FAULT_FLAG_WRITE && !pmd_write (orig_pmd) && - !pmd_trans_splitting (orig_pmd)) + !pmd_trans_splitting (orig_pmd) && + !vma->vm_ops)return do_huge_pmd_wp_page (mm, vma, address, pmd, orig_pmd);return 0 ;
so if vma->vm_ops != NULL, how could the pmd_trans_huge(orig_pmd) be true? We never enable THP if vma->vm_ops != NULL.
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
On 11/1/2011 at 09:18 AM, in message <1320110288.22361.190.camel@sli10-conroe>,
Quoted 20 lines · Shaohua Li
mm/memory.c int handle_mm_fault(struct mm_struct *mm, struct
Quoted 18 lines · Guanjun He
For the transparent hugepage module still does not support tmpfs and cache,the check condition should always be checked to make sure that it only affect the anonymous maps, the original check condition missed this, this patch is to fix this. Otherwise,the hugepage may affect the file-backed maps, then the cache for the small-size pages will be unuseful, and till now there is still no implementation for hugepage's cache.
Signed-off-by Guanjun He <[email protected]>--- mm/memory.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)mm/memory.c +0
-0@@ -3475,7 +3475,8 @@ int handle_mm_fault(struct mm_struct *mm, struct
vm_area_struct*vma,
Quoted 11 lines
mm/memory.c int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, · line 3482
Quoted 9 lines
mm/memory.c +2
-1if (pmd_trans_huge (orig_pmd)) {if (flags &FAULT_FLAG_WRITE && !pmd_write (orig_pmd) && - !pmd_trans_splitting (orig_pmd)) + !pmd_trans_splitting (orig_pmd) && + !vma->vm_ops)return do_huge_pmd_wp_page (mm, vma, address, pmd, orig_pmd);return 0 ;so if
vma->vm_ops!= NULL, how could thepmd_trans_huge(orig_pmd)be true? We never enable THP ifvma->vm_ops!= NULL.
acturally, pmd_trans_huge(orig_pmd) only checks the _PAGE_PSE bits, it's only a pagesize, not a flag to identity a hugepage.
If I change my default pagesize to PAGE_PSE, then THP will be confused.
There is already a defination:
#define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */
maybe,this can be the flag to identity a hugepage.But the comment marked it only stands for MADV_HUGEPAGE, and it's still a hugepage.So, I suggest to add the check condition !vma->vm_ops, or turn to use VM_HUGEPAGE as the flag.
or
adjust the logic to:
(transparent_hugepage_enabled() use the VM_HUGEPAGE flag)
if(transparent_hugepage_enabled(vma)){
if (pmd_none(*pmd){
...
}
else
{
...
}
}the original logic is:
if (pmd_none(*pmd) && transparent_hugepage_enabled(vma)) {
...
}
else
{
...
}
2011/11/1 Guan Jun He <[email protected]>:
Quoted 33 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
On 11/1/2011 at 09:18 AM, in message <1320110288.22361.190.camel@sli10-conroe>,
Quoted 29 lines · Shaohua Li
mm/memory.c int handle_mm_fault(struct mm_struct *mm, struct
Quoted 18 lines · Guanjun He
For the transparent hugepage module still does not support tmpfs and cache,the check condition should always be checked to make sure that it only affect the anonymous maps, the original check condition missed this, this patch is to fix this. Otherwise,the hugepage may affect the file-backed maps, then the cache for the small-size pages will be unuseful, and till now there is still no implementation for hugepage's cache.
Signed-off-by Guanjun He <[email protected]>---
mm/memory.c | 3 ++-1 files changed, 2 insertions(+), 1 deletions(-)mm/memory.c +0
-0@@ -3475,7 +3475,8 @@ int handle_mm_fault(struct mm_struct *mm, struct
vm_area_struct*vma,Quoted 9 lines
mm/memory.c +0
-0if (pmd_trans_huge(orig_pmd)) {if (flags &
FAULT_FLAG_WRITE&& !pmd_write(orig_pmd) &&
- !pmd_trans_splitting(orig_pmd))
+ !pmd_trans_splitting(orig_pmd) &&
+ !vma->vm_ops)
returndo_huge_pmd_wp_page(mm, vma, address, pmd, orig_pmd); return 0;
Quoted 5 lines
Quoted 2 lines
so if
vma->vm_ops!= NULL, how could thepmd_trans_huge(orig_pmd)be true? We never enable THP ifvma->vm_ops!= NULL.acturally,
pmd_trans_huge(orig_pmd)only checks the_PAGE_PSEbits, it's only a pagesize, not a flag to identity a hugepage. If I change my default pagesize toPAGE_PSE,
Not sure what pagesize means here, assume pmd entry bits. how could you make the default 'pagesize' to PAGE_PSE?
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
On 11/1/2011 at 04:42 PM, in message
<CANejiEVk41X-P+UyMf96jmPrJJ5-_vbubYtnQgaWXY2FLb41iw@mail.gmail.com>, Shaohua
Quoted 34 lines · Li
2011/11/1 Guan Jun He <[email protected]>:
Quoted 33 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
On 11/1/2011 at 09:18 AM, in message <1320110288.22361.190.camel@sli10-conroe>,
Quoted 29 lines · Shaohua Li
mm/memory.c int handle_mm_fault(struct mm_struct *mm, struct
Quoted 18 lines · Guanjun He
For the transparent hugepage module still does not support tmpfs and cache,the check condition should always be checked to make sure that it only affect the anonymous maps, the original check condition missed this, this patch is to fix this. Otherwise,the hugepage may affect the file-backed maps, then the cache for the small-size pages will be unuseful, and till now there is still no implementation for hugepage's cache.
Signed-off-by Guanjun He <[email protected]>--- mm/memory.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)mm/memory.c +0
-0@@ -3475,7 +3475,8 @@ int handle_mm_fault(struct mm_struct *mm, struct
vm_area_struct*vma,Quoted 9 lines
mm/memory.c +2
-1if (pmd_trans_huge (orig_pmd)) {if (flags &FAULT_FLAG_WRITE && !pmd_write (orig_pmd) && - !pmd_trans_splitting (orig_pmd)) + !pmd_trans_splitting (orig_pmd) && + !vma->vm_ops)return do_huge_pmd_wp_page (mm, vma, address, pmd, orig_pmd);return 0 ;
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
so if
vma->vm_ops!= NULL, how could thepmd_trans_huge(orig_pmd)be true? We never enable THP ifvma->vm_ops!= NULL.acturally,
pmd_trans_huge(orig_pmd)only checks the_PAGE_PSEbits, it's only a pagesize, not a flag to identity a hugepage. If I change my default pagesize toPAGE_PSE,Not sure what pagesize means here, assume pmd entry bits.
yes, it's pmd entry bits.
Quoted 1 line
how could you make the default 'pagesize' to
PAGE_PSE?
That requires some work and not so easy and need hardware support... So, recently it won't come. But one can easily create the same pmd entry bits for some special use;
as comment above, it's a pmd entry bits, only mark a size, not a flag;
and adjust the logic to use the flag can perfect avoid this potential issuse, and basically no impact to the current code.
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>