Re: [PATCH 2/6] ksm: add cond_resched() to the rmap_walks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 15 Oct 2015, Andrea Arcangeli wrote:

> While at it add it to the file and anon walks too.
> 
> Signed-off-by: Andrea Arcangeli <aarcange@xxxxxxxxxx>

Subject really should be "mm: add cond_resched() to the rmap walks",
then body "Add cond_resched() to the ksm and anon and file rmap walks."

Acked-by: Hugh Dickins <hughd@xxxxxxxxxx>
but I think we need a blessing from Davidlohr too, if not more.

> ---
>  mm/ksm.c  | 2 ++
>  mm/rmap.c | 4 ++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/mm/ksm.c b/mm/ksm.c
> index 8fc6793..39ef485 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -1961,9 +1961,11 @@ again:
>  		struct anon_vma_chain *vmac;
>  		struct vm_area_struct *vma;
>  
> +		cond_resched();
>  		anon_vma_lock_read(anon_vma);
>  		anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root,
>  					       0, ULONG_MAX) {
> +			cond_resched();
>  			vma = vmac->vma;
>  			if (rmap_item->address < vma->vm_start ||
>  			    rmap_item->address >= vma->vm_end)
> diff --git a/mm/rmap.c b/mm/rmap.c
> index f5b5c1f..b949778 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -1607,6 +1607,8 @@ static int rmap_walk_anon(struct page *page, struct rmap_walk_control *rwc)
>  		struct vm_area_struct *vma = avc->vma;
>  		unsigned long address = vma_address(page, vma);
>  
> +		cond_resched();
> +
>  		if (rwc->invalid_vma && rwc->invalid_vma(vma, rwc->arg))
>  			continue;
>  
> @@ -1656,6 +1658,8 @@ static int rmap_walk_file(struct page *page, struct rmap_walk_control *rwc)
>  	vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff, pgoff) {
>  		unsigned long address = vma_address(page, vma);
>  
> +		cond_resched();
> +
>  		if (rwc->invalid_vma && rwc->invalid_vma(vma, rwc->arg))
>  			continue;
>  

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]