public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: /proc/pid/clear_refs: no need to clear VM_SOFTDIRTY in clear_soft_dirty_pmd()
@ 2015-12-16 17:26 Oleg Nesterov
  2015-12-16 17:43 ` Kirill A. Shutemov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Oleg Nesterov @ 2015-12-16 17:26 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Kirill A. Shutemov, Naoya Horiguchi, Cyrill Gorcunov,
	linux-kernel

clear_soft_dirty_pmd() is called by clear_refs_write(CLEAR_REFS_SOFT_DIRTY),
VM_SOFTDIRTY was already cleared before walk_page_range().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 fs/proc/task_mmu.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 187b3b5..1a02b15 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -817,9 +817,6 @@ static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma,
 	pmd = pmd_wrprotect(pmd);
 	pmd = pmd_clear_soft_dirty(pmd);
 
-	if (vma->vm_flags & VM_SOFTDIRTY)
-		vma->vm_flags &= ~VM_SOFTDIRTY;
-
 	set_pmd_at(vma->vm_mm, addr, pmdp, pmd);
 }
 #else
-- 
1.5.5.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: /proc/pid/clear_refs: no need to clear VM_SOFTDIRTY in clear_soft_dirty_pmd()
  2015-12-16 17:26 [PATCH] mm: /proc/pid/clear_refs: no need to clear VM_SOFTDIRTY in clear_soft_dirty_pmd() Oleg Nesterov
@ 2015-12-16 17:43 ` Kirill A. Shutemov
  2015-12-16 17:51 ` Cyrill Gorcunov
  2015-12-22 21:59 ` David Rientjes
  2 siblings, 0 replies; 4+ messages in thread
From: Kirill A. Shutemov @ 2015-12-16 17:43 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Kirill A. Shutemov, Naoya Horiguchi,
	Cyrill Gorcunov, linux-kernel

On Wed, Dec 16, 2015 at 06:26:32PM +0100, Oleg Nesterov wrote:
> clear_soft_dirty_pmd() is called by clear_refs_write(CLEAR_REFS_SOFT_DIRTY),
> VM_SOFTDIRTY was already cleared before walk_page_range().

Not only that, We shouldn't [generally] change vm_flags without exclusive
mmap_sem and we have only down_read() here.

> Signed-off-by: Oleg Nesterov <oleg@redhat.com>

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

> ---
>  fs/proc/task_mmu.c |    3 ---
>  1 files changed, 0 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index 187b3b5..1a02b15 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -817,9 +817,6 @@ static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma,
>  	pmd = pmd_wrprotect(pmd);
>  	pmd = pmd_clear_soft_dirty(pmd);
>  
> -	if (vma->vm_flags & VM_SOFTDIRTY)
> -		vma->vm_flags &= ~VM_SOFTDIRTY;
> -
>  	set_pmd_at(vma->vm_mm, addr, pmdp, pmd);
>  }
>  #else
> -- 
> 1.5.5.1
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
 Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: /proc/pid/clear_refs: no need to clear VM_SOFTDIRTY in clear_soft_dirty_pmd()
  2015-12-16 17:26 [PATCH] mm: /proc/pid/clear_refs: no need to clear VM_SOFTDIRTY in clear_soft_dirty_pmd() Oleg Nesterov
  2015-12-16 17:43 ` Kirill A. Shutemov
@ 2015-12-16 17:51 ` Cyrill Gorcunov
  2015-12-22 21:59 ` David Rientjes
  2 siblings, 0 replies; 4+ messages in thread
From: Cyrill Gorcunov @ 2015-12-16 17:51 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Kirill A. Shutemov, Naoya Horiguchi, linux-kernel

On Wed, Dec 16, 2015 at 06:26:32PM +0100, Oleg Nesterov wrote:
> clear_soft_dirty_pmd() is called by clear_refs_write(CLEAR_REFS_SOFT_DIRTY),
> VM_SOFTDIRTY was already cleared before walk_page_range().
> 
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>

Thank you!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: /proc/pid/clear_refs: no need to clear VM_SOFTDIRTY in clear_soft_dirty_pmd()
  2015-12-16 17:26 [PATCH] mm: /proc/pid/clear_refs: no need to clear VM_SOFTDIRTY in clear_soft_dirty_pmd() Oleg Nesterov
  2015-12-16 17:43 ` Kirill A. Shutemov
  2015-12-16 17:51 ` Cyrill Gorcunov
@ 2015-12-22 21:59 ` David Rientjes
  2 siblings, 0 replies; 4+ messages in thread
From: David Rientjes @ 2015-12-22 21:59 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Kirill A. Shutemov, Naoya Horiguchi,
	Cyrill Gorcunov, linux-kernel

On Wed, 16 Dec 2015, Oleg Nesterov wrote:

> clear_soft_dirty_pmd() is called by clear_refs_write(CLEAR_REFS_SOFT_DIRTY),
> VM_SOFTDIRTY was already cleared before walk_page_range().
> 
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>

Acked-by: David Rientjes <rientjes@google.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-22 22:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-16 17:26 [PATCH] mm: /proc/pid/clear_refs: no need to clear VM_SOFTDIRTY in clear_soft_dirty_pmd() Oleg Nesterov
2015-12-16 17:43 ` Kirill A. Shutemov
2015-12-16 17:51 ` Cyrill Gorcunov
2015-12-22 21:59 ` David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox