* [PATCH][mm/memory.c]: transparent hugepage check condition missed @ 2011-10-31 10:56 GuanJun He 2011-11-23 0:10 ` Andrea Arcangeli 0 siblings, 1 reply; 7+ messages in thread From: GuanJun He @ 2011-10-31 10:56 UTC (permalink / raw) To: torvalds, linux-kernel 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 <gjhe@suse.com> --- mm/memory.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index a56e3ba..79b85fe 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -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; -- ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH][mm/memory.c]: transparent hugepage check condition missed 2011-10-31 10:56 [PATCH][mm/memory.c]: transparent hugepage check condition missed GuanJun He @ 2011-11-23 0:10 ` Andrea Arcangeli 0 siblings, 0 replies; 7+ messages in thread From: Andrea Arcangeli @ 2011-11-23 0:10 UTC (permalink / raw) To: GuanJun He; +Cc: torvalds, linux-kernel, Andrew Morton Hi, On Mon, Oct 31, 2011 at 06:56:57PM +0800, GuanJun He wrote: > 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 <gjhe@suse.com> > --- > mm/memory.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/mm/memory.c b/mm/memory.c > index a56e3ba..79b85fe 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -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; Not needed, this is the cow case and pmd_trans_huge can't be true if vm_ops is not null. That's already checked a few lines before the above code and in collapse_huge_page for khugepaged. Thanks. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <transparent-hugepage-check-condition-miss>]
[parent not found: <1320049412-12642-1-git-send-email-gjhe@suse.com>]
* Re: [PATCH][mm/memory.c]: transparent hugepage check condition missed [not found] ` <1320049412-12642-1-git-send-email-gjhe@suse.com> @ 2011-11-01 1:18 ` Shaohua Li 2011-11-01 8:21 ` Guan Jun He 0 siblings, 1 reply; 7+ messages in thread From: Shaohua Li @ 2011-11-01 1:18 UTC (permalink / raw) To: Guanjun He; +Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org On Mon, 2011-10-31 at 16:23 +0800, Guanjun He wrote: > 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 <gjhe@suse.com> > --- > mm/memory.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/mm/memory.c b/mm/memory.c > index a56e3ba..79b85fe 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -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. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][mm/memory.c]: transparent hugepage check condition missed 2011-11-01 1:18 ` Shaohua Li @ 2011-11-01 8:21 ` Guan Jun He 2011-11-01 8:42 ` Shaohua Li 0 siblings, 1 reply; 7+ messages in thread From: Guan Jun He @ 2011-11-01 8:21 UTC (permalink / raw) To: Shaohua Li; +Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org >>> On 11/1/2011 at 09:18 AM, in message <1320110288.22361.190.camel@sli10-conroe>, Shaohua Li <shaohua.li@intel.com> wrote: > On Mon, 2011-10-31 at 16:23 +0800, Guanjun He wrote: >> 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 <gjhe@suse.com> >> --- >> mm/memory.c | 3 ++- >> 1 files changed, 2 insertions(+), 1 deletions(-) >> >> diff --git a/mm/memory.c b/mm/memory.c >> index a56e3ba..79b85fe 100644 >> --- a/mm/memory.c >> +++ b/mm/memory.c >> @@ -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. 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 { ... } ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][mm/memory.c]: transparent hugepage check condition missed 2011-11-01 8:21 ` Guan Jun He @ 2011-11-01 8:42 ` Shaohua Li 2011-11-01 9:18 ` Guan Jun He 0 siblings, 1 reply; 7+ messages in thread From: Shaohua Li @ 2011-11-01 8:42 UTC (permalink / raw) To: Guan Jun He; +Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org 2011/11/1 Guan Jun He <gjhe@suse.com>: > > >>>> On 11/1/2011 at 09:18 AM, in message <1320110288.22361.190.camel@sli10-conroe>, > Shaohua Li <shaohua.li@intel.com> wrote: >> On Mon, 2011-10-31 at 16:23 +0800, Guanjun He wrote: >>> 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 <gjhe@suse.com> >>> --- >>> mm/memory.c | 3 ++- >>> 1 files changed, 2 insertions(+), 1 deletions(-) >>> >>> diff --git a/mm/memory.c b/mm/memory.c >>> index a56e3ba..79b85fe 100644 >>> --- a/mm/memory.c >>> +++ b/mm/memory.c >>> @@ -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. > 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, Not sure what pagesize means here, assume pmd entry bits. how could you make the default 'pagesize' to PAGE_PSE? ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][mm/memory.c]: transparent hugepage check condition missed 2011-11-01 8:42 ` Shaohua Li @ 2011-11-01 9:18 ` Guan Jun He 0 siblings, 0 replies; 7+ messages in thread From: Guan Jun He @ 2011-11-01 9:18 UTC (permalink / raw) To: Shaohua Li; +Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org >>> On 11/1/2011 at 04:42 PM, in message <CANejiEVk41X-P+UyMf96jmPrJJ5-_vbubYtnQgaWXY2FLb41iw@mail.gmail.com>, Shaohua Li <shaohua.li@intel.com> wrote: > 2011/11/1 Guan Jun He <gjhe@suse.com>: >> >> >>>>> On 11/1/2011 at 09:18 AM, in message <1320110288.22361.190.camel@sli10-conroe>, >> Shaohua Li <shaohua.li@intel.com> wrote: >>> On Mon, 2011-10-31 at 16:23 +0800, Guanjun He wrote: >>>> 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 <gjhe@suse.com> >>>> --- >>>> mm/memory.c | 3 ++- >>>> 1 files changed, 2 insertions(+), 1 deletions(-) >>>> >>>> diff --git a/mm/memory.c b/mm/memory.c >>>> index a56e3ba..79b85fe 100644 >>>> --- a/mm/memory.c >>>> +++ b/mm/memory.c >>>> @@ -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. >> 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, > Not sure what pagesize means here, assume pmd entry bits. yes, it's pmd entry bits. > 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. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <1320051775-13992-1-git-send-email-gjhe@suse.com>]
* Re: [PATCH][mm/memory.c]: transparent hugepage check condition missed [not found] <1320051775-13992-1-git-send-email-gjhe@suse.com> @ 2011-10-31 9:26 ` Guan Jun He 0 siblings, 0 replies; 7+ messages in thread From: Guan Jun He @ 2011-10-31 9:26 UTC (permalink / raw) To: torvalds, Guan Jun He, linux-kernel Excuse me! I got the one email sent 6 times! best, Guanjun >>> On 10/31/2011 at 05:02 PM, in message <1320051775-13992-1-git-send-email-gjhe@suse.com>, Guanjun He <gjhe@suse.com> wrote: > 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 <gjhe@suse.com> > --- > mm/memory.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/mm/memory.c b/mm/memory.c > index a56e3ba..79b85fe 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -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; ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-11-23 0:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-31 10:56 [PATCH][mm/memory.c]: transparent hugepage check condition missed GuanJun He
2011-11-23 0:10 ` Andrea Arcangeli
[not found] <transparent-hugepage-check-condition-miss>
[not found] ` <1320049412-12642-1-git-send-email-gjhe@suse.com>
2011-11-01 1:18 ` Shaohua Li
2011-11-01 8:21 ` Guan Jun He
2011-11-01 8:42 ` Shaohua Li
2011-11-01 9:18 ` Guan Jun He
[not found] <1320051775-13992-1-git-send-email-gjhe@suse.com>
2011-10-31 9:26 ` Guan Jun He
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox