linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: add cond_resched() in gather_pte_stats()
@ 2016-12-06  6:00 Hugh Dickins
  2016-12-07 12:31 ` Michal Hocko
  0 siblings, 1 reply; 2+ messages in thread
From: Hugh Dickins @ 2016-12-06  6:00 UTC (permalink / raw)
  To: Andrew Morton; +Cc: David Rientjes, Gerald Schaefer, linux-mm

The other pagetable walks in task_mmu.c have a cond_resched() after
walking their ptes: add a cond_resched() in gather_pte_stats() too,
for reading /proc/<id>/numa_maps.  Only pagemap_pmd_range() has a
cond_resched() in its (unusually expensive) pmd_trans_huge case:
more should probably be added, but leave them unchanged for now.

Signed-off-by: Hugh Dickins <hughd@google.com>
---

 fs/proc/task_mmu.c |    1 +
 1 file changed, 1 insertion(+)

--- 4.9-rc8/fs/proc/task_mmu.c	2016-10-23 17:33:00.156860538 -0700
+++ linux/fs/proc/task_mmu.c	2016-12-05 20:27:04.084531599 -0800
@@ -1588,6 +1588,7 @@ static int gather_pte_stats(pmd_t *pmd,
 
 	} while (pte++, addr += PAGE_SIZE, addr != end);
 	pte_unmap_unlock(orig_pte, ptl);
+	cond_resched();
 	return 0;
 }
 #ifdef CONFIG_HUGETLB_PAGE

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

* Re: [PATCH] mm: add cond_resched() in gather_pte_stats()
  2016-12-06  6:00 [PATCH] mm: add cond_resched() in gather_pte_stats() Hugh Dickins
@ 2016-12-07 12:31 ` Michal Hocko
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2016-12-07 12:31 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: Andrew Morton, David Rientjes, Gerald Schaefer, linux-mm

On Mon 05-12-16 22:00:22, Hugh Dickins wrote:
> The other pagetable walks in task_mmu.c have a cond_resched() after
> walking their ptes: add a cond_resched() in gather_pte_stats() too,
> for reading /proc/<id>/numa_maps.  Only pagemap_pmd_range() has a
> cond_resched() in its (unusually expensive) pmd_trans_huge case:
> more should probably be added, but leave them unchanged for now.

The patch seems correct, I am just wondering whether pushing the
cond_resched into the pte walk code (walk_pmd_range) would be more
appropriate.
 
> Signed-off-by: Hugh Dickins <hughd@google.com>

Anyway
Acked-by: Michal Hocko <mhocko@suse.com>

> ---
> 
>  fs/proc/task_mmu.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> --- 4.9-rc8/fs/proc/task_mmu.c	2016-10-23 17:33:00.156860538 -0700
> +++ linux/fs/proc/task_mmu.c	2016-12-05 20:27:04.084531599 -0800
> @@ -1588,6 +1588,7 @@ static int gather_pte_stats(pmd_t *pmd,
>  
>  	} while (pte++, addr += PAGE_SIZE, addr != end);
>  	pte_unmap_unlock(orig_pte, ptl);
> +	cond_resched();
>  	return 0;
>  }
>  #ifdef CONFIG_HUGETLB_PAGE
> 
> --
> 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>

-- 
Michal Hocko
SUSE Labs

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

end of thread, other threads:[~2016-12-07 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-06  6:00 [PATCH] mm: add cond_resched() in gather_pte_stats() Hugh Dickins
2016-12-07 12:31 ` Michal Hocko

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