linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/THP: Use the right function when updating access flags
@ 2013-05-06 20:49 Aneesh Kumar K.V
  2013-05-08 20:04 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Aneesh Kumar K.V @ 2013-05-06 20:49 UTC (permalink / raw)
  To: aarcange, akpm; +Cc: linux-mm, Aneesh Kumar K.V

From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>

We should use pmdp_set_access_flags to update access flags. Archs like powerpc
use extra checks(_PAGE_BUSY) when updating a hugepage PTE. A set_pmd_at doesn't
do those checks. We should use set_pmd_at only when updating a none hugepage PTE.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 mm/huge_memory.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index d1cecb9..af20bb1 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1265,7 +1265,9 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
 		 * young bit, instead of the current set_pmd_at.
 		 */
 		_pmd = pmd_mkyoung(pmd_mkdirty(*pmd));
-		set_pmd_at(mm, addr & HPAGE_PMD_MASK, pmd, _pmd);
+		if (pmdp_set_access_flags(vma, addr & HPAGE_PMD_MASK,
+					  pmd, _pmd,  1))
+			update_mmu_cache_pmd(vma, addr, pmd);
 	}
 	if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) {
 		if (page->mapping && trylock_page(page)) {
-- 
1.8.1.2

--
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 related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/THP: Use the right function when updating access flags
  2013-05-06 20:49 [PATCH] mm/THP: Use the right function when updating access flags Aneesh Kumar K.V
@ 2013-05-08 20:04 ` Andrew Morton
  2013-05-12  8:37   ` Aneesh Kumar K.V
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2013-05-08 20:04 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: aarcange, linux-mm

On Tue,  7 May 2013 02:19:48 +0530 "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:

> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
> 
> We should use pmdp_set_access_flags to update access flags. Archs like powerpc
> use extra checks(_PAGE_BUSY) when updating a hugepage PTE. A set_pmd_at doesn't
> do those checks. We should use set_pmd_at only when updating a none hugepage PTE.
> 
> ...
>
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -1265,7 +1265,9 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
>  		 * young bit, instead of the current set_pmd_at.
>  		 */
>  		_pmd = pmd_mkyoung(pmd_mkdirty(*pmd));
> -		set_pmd_at(mm, addr & HPAGE_PMD_MASK, pmd, _pmd);
> +		if (pmdp_set_access_flags(vma, addr & HPAGE_PMD_MASK,
> +					  pmd, _pmd,  1))
> +			update_mmu_cache_pmd(vma, addr, pmd);
>  	}
>  	if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) {
>  		if (page->mapping && trylock_page(page)) {

<canned message>
When writing a changelog, please describe the end-user-visible effects
of the bug, so that others can more easily decide which kernel
version(s) should be fixed, and so that downstream kernel maintainers
can more easily work out whether this patch will fix a problem which
they or their customers are observing.

--
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] 3+ messages in thread

* Re: [PATCH] mm/THP: Use the right function when updating access flags
  2013-05-08 20:04 ` Andrew Morton
@ 2013-05-12  8:37   ` Aneesh Kumar K.V
  0 siblings, 0 replies; 3+ messages in thread
From: Aneesh Kumar K.V @ 2013-05-12  8:37 UTC (permalink / raw)
  To: Andrew Morton; +Cc: aarcange, linux-mm

Andrew Morton <akpm@linux-foundation.org> writes:

> On Tue,  7 May 2013 02:19:48 +0530 "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:
>
>> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
>> 
>> We should use pmdp_set_access_flags to update access flags. Archs like powerpc
>> use extra checks(_PAGE_BUSY) when updating a hugepage PTE. A set_pmd_at doesn't
>> do those checks. We should use set_pmd_at only when updating a none hugepage PTE.
>> 
>> ...
>>
>> --- a/mm/huge_memory.c
>> +++ b/mm/huge_memory.c
>> @@ -1265,7 +1265,9 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
>>  		 * young bit, instead of the current set_pmd_at.
>>  		 */
>>  		_pmd = pmd_mkyoung(pmd_mkdirty(*pmd));
>> -		set_pmd_at(mm, addr & HPAGE_PMD_MASK, pmd, _pmd);
>> +		if (pmdp_set_access_flags(vma, addr & HPAGE_PMD_MASK,
>> +					  pmd, _pmd,  1))
>> +			update_mmu_cache_pmd(vma, addr, pmd);
>>  	}
>>  	if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) {
>>  		if (page->mapping && trylock_page(page)) {
>
> <canned message>
> When writing a changelog, please describe the end-user-visible effects
> of the bug, so that others can more easily decide which kernel
> version(s) should be fixed, and so that downstream kernel maintainers
> can more easily work out whether this patch will fix a problem which
> they or their customers are observing.

I found that reading code while debugging some crashes with THP on
ppc64. So user visible effects would mostly be some random crashes. 
I will make sure to document the user visible effects next time.

-aneesh

--
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] 3+ messages in thread

end of thread, other threads:[~2013-05-12  8:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-06 20:49 [PATCH] mm/THP: Use the right function when updating access flags Aneesh Kumar K.V
2013-05-08 20:04 ` Andrew Morton
2013-05-12  8:37   ` Aneesh Kumar K.V

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).