swap: cond_resched in swap_cgroup_prepare()
Subsystems (2)
PATCH 1/1 swap: cond_resched in swap_cgroup_prepare()
Saw need_resched() warnings when swapping on large swapfile (TBs) because page allocation in swap_cgroup_prepare() took too long.
We already cond_resched when freeing page in swap_cgroup_swapoff(). Do the same for the page allocation.
--- mm/swap_cgroup.c | 3 +++ 1 file changed, 3 insertions(+)
mm/swap_cgroup.c +3 -0
@@ -48,6 +48,9 @@ static int swap_cgroup_prepare(int type)if (!page) goto not_enough_page; ctrl->map[idx] = page; + +if (!(idx %SWAP_CLUSTER_MAX )) +cond_resched (); }return 0 ; not_enough_page:
Signature · 7 lines
2.13.0.219.gdb65acc882-goog -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 2 lines · Yu Zhao
Saw
need_resched()warnings when swapping on large swapfile (TBs) because page allocation inswap_cgroup_prepare()took too long.
Hmm, but the page allocator makes sure to cond_resched for sleeping allocations. I guess what you mean is something different. It is not the allocation which took too look but there are too many of them and none of them sleeps because there is enough memory and the allocator doesn't sleep in that case. Right?
Quoted 4 lines
We already
cond_reschedwhen freeing page inswap_cgroup_swapoff(). Do the same for the page allocation.Signed-off-by Yu Zhao <[email protected]>
The patch itself makes sense to me, the changelog could see some clarification but other than that
Quoted 20 lines
--- mm/swap_cgroup.c | 3 +++ 1 file changed, 3 insertions(+)mm/swap_cgroup.c +3
-0@@ -48,6 +48,9 @@ static int swap_cgroup_prepare(int type)if (!page) goto not_enough_page; ctrl->map[idx] = page; + +if (!(idx %SWAP_CLUSTER_MAX )) +cond_resched (); }return 0 ; not_enough_page:Signature · 1 line
2.13.0.219.gdb65acc882-goog
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 7 lines · Yu Zhao
Saw
need_resched()warnings when swapping on large swapfile (TBs) because page allocation inswap_cgroup_prepare()took too long.We already
cond_reschedwhen freeing page inswap_cgroup_swapoff(). Do the same for the page allocation.Signed-off-by Yu Zhao <[email protected]>
Quoted 9 lines
--- mm/swap_cgroup.c | 3 +++ 1 file changed, 3 insertions(+)mm/swap_cgroup.c +0
-0
mm/swap_cgroup.c static int swap_cgroup_prepare(int type) · line 56
Quoted 9 lines
mm/swap_cgroup.c +3
-0@@ -48,6 +48,9 @@ static int swap_cgroup_prepare(int type)if (!page) goto not_enough_page; ctrl->map[idx] = page; + +if (!(idx %SWAP_CLUSTER_MAX )) +cond_resched (); }return 0 ; not_enough_page:
We should probably do the same on the error path.
Quoted 10 lines · Michal Hocko
Quoted 2 lines · Yu Zhao
Saw
need_resched()warnings when swapping on large swapfile (TBs) because page allocation inswap_cgroup_prepare()took too long.Hmm, but the page allocator makes sure to
cond_reschedfor sleeping allocations. I guess what you mean is something different. It is not the allocation which took too look but there are too many of them and none of them sleeps because there is enough memory and the allocator doesn't sleep in that case. Right?
Quoted 8 lines
Quoted 4 lines
We already
cond_reschedwhen freeing page inswap_cgroup_swapoff(). Do the same for the page allocation.Signed-off-by Yu Zhao <[email protected]>The patch itself makes sense to me, the changelog could see some clarification but other than that
Acked-by Michal Hocko <[email protected]>
Thanks, I'll clarify the problem in the commit message and resend the patch.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 1/1 swap: cond_resched in swap_cgroup_prepare()
In reply to Yu ZhaoSaw need_resched() warnings when swapping on large swapfile (TBs) because continuously allocating many pages in swap_cgroup_prepare() took too long.
We already cond_resched when freeing page in swap_cgroup_swapoff(). Do the same for the page allocation.
---
Changelog since v1:
* clarify the problem in the commit message
mm/swap_cgroup.c | 3 +++ 1 file changed, 3 insertions(+)
mm/swap_cgroup.c +3 -0
@@ -48,6 +48,9 @@ static int swap_cgroup_prepare(int type)if (!page) goto not_enough_page; ctrl->map[idx] = page; + +if (!(idx %SWAP_CLUSTER_MAX )) +cond_resched (); }return 0 ; not_enough_page:
Signature · 1 line
2.13.0.506.g27d5fe0cd-goog
[CC Andrew]
Quoted 33 lines · Yu Zhao
Saw
need_resched()warnings when swapping on large swapfile (TBs) because continuously allocating many pages inswap_cgroup_prepare()took too long.We already
cond_reschedwhen freeing page inswap_cgroup_swapoff(). Do the same for the page allocation.Signed-off-by Yu Zhao <[email protected]>Acked-by Michal Hocko <[email protected]>Acked-by Vladimir Davydov <[email protected]>---
Changelog since v1:
* clarify the problem in the commit messagemm/swap_cgroup.c | 3 +++ 1 file changed, 3 insertions(+)mm/swap_cgroup.c +3
-0@@ -48,6 +48,9 @@ static int swap_cgroup_prepare(int type)if (!page) goto not_enough_page; ctrl->map[idx] = page; + +if (!(idx %SWAP_CLUSTER_MAX )) +cond_resched (); }return 0 ; not_enough_page:Signature · 1 line
2.13.0.506.g27d5fe0cd-goog
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>