[rh7,2/2] mm/memcg: bypass kmem limits

Submitted by Andrey Ryabinin on Feb. 28, 2018, 10:36 a.m.

Details

Message ID 20180228103627.2427-2-aryabinin@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Andrey Ryabinin Feb. 28, 2018, 10:36 a.m.
Relax kmem limit and bypass allocation anyway even if reclaim failed.

https://jira.sw.ru/browse/PSBM-81818
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/memcontrol.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index d68650ad7a53..32c6b254ce7d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2863,6 +2863,13 @@  charge:
 
 	if (gfp_mask & __GFP_NORETRY)
 		goto nomem;
+
+	if ((flags & MEM_CGROUP_RECLAIM_KMEM) && nr_retries--)
+		goto retry;
+
+	if (flags & MEM_CGROUP_RECLAIM_KMEM)
+		goto bypass;
+
 	/*
 	 * Even though the limit is exceeded at this point, reclaim
 	 * may have been able to free some pages.  Retry the charge
@@ -2895,7 +2902,7 @@  charge:
 nomem:
 	mem_cgroup_inc_failcnt(mem_over_limit, gfp_mask, nr_pages);
 
-	if (!(gfp_mask & __GFP_NOFAIL))
+	if (!(gfp_mask & __GFP_NOFAIL) && !(flags & MEM_CGROUP_RECLAIM_KMEM))
 		return -ENOMEM;
 bypass:
 	return -EINTR;

Comments

Konstantin Khorenko March 1, 2018, 8:37 a.m.
We are not happy with changing mainstream logic of kmem.limit (switching it to softlimit).
As we have fixed kmem.limit logic with previous patch, let's test it now, may be its enough and soft limit is not needed anymore.

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 02/28/2018 01:36 PM, Andrey Ryabinin wrote:
> Relax kmem limit and bypass allocation anyway even if reclaim failed.
>
> https://jira.sw.ru/browse/PSBM-81818
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> ---
>  mm/memcontrol.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index d68650ad7a53..32c6b254ce7d 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2863,6 +2863,13 @@ charge:
>
>  	if (gfp_mask & __GFP_NORETRY)
>  		goto nomem;
> +
> +	if ((flags & MEM_CGROUP_RECLAIM_KMEM) && nr_retries--)
> +		goto retry;
> +
> +	if (flags & MEM_CGROUP_RECLAIM_KMEM)
> +		goto bypass;
> +
>  	/*
>  	 * Even though the limit is exceeded at this point, reclaim
>  	 * may have been able to free some pages.  Retry the charge
> @@ -2895,7 +2902,7 @@ charge:
>  nomem:
>  	mem_cgroup_inc_failcnt(mem_over_limit, gfp_mask, nr_pages);
>
> -	if (!(gfp_mask & __GFP_NOFAIL))
> +	if (!(gfp_mask & __GFP_NOFAIL) && !(flags & MEM_CGROUP_RECLAIM_KMEM))
>  		return -ENOMEM;
>  bypass:
>  	return -EINTR;
>