linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: memcontrol: drain memcg stock on force_empty
@ 2018-05-07 20:16 Shakeel Butt
  2018-05-07 20:19 ` Shakeel Butt
  2018-05-09  8:18 ` Michal Hocko
  0 siblings, 2 replies; 3+ messages in thread
From: Shakeel Butt @ 2018-05-07 20:16 UTC (permalink / raw)
  To: Michal Hocko, Andrew Morton, Greg Thelen, Johannes Weiner,
	Vladimir Davydov
  Cc: Linux MM, Cgroups, LKML, Junaid Shahid, Junaid Shahid, Shakeel Butt

From: Junaid Shahid <junaids@google.com>

The per-cpu memcg stock can retain a charge of upto 32 pages. On a
machine with large number of cpus, this can amount to a decent amount
of memory. Additionally force_empty interface might be triggering
unneeded memcg reclaims.

Signed-off-by: Junaid Shahid <juanids@google.com>
Signed-off-by: Shakeel Butt <shakeelb@google.com>
---
 mm/memcontrol.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e2d33a37f971..2c3c69524b49 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2841,6 +2841,9 @@ static int mem_cgroup_force_empty(struct mem_cgroup *memcg)
 
 	/* we call try-to-free pages for make this cgroup empty */
 	lru_add_drain_all();
+
+	drain_all_stock(memcg);
+
 	/* try to free all pages in this cgroup */
 	while (nr_retries && page_counter_read(&memcg->memory)) {
 		int progress;
-- 
2.17.0.441.gb46fe60e1d-goog

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

* Re: [PATCH] mm: memcontrol: drain memcg stock on force_empty
  2018-05-07 20:16 [PATCH] mm: memcontrol: drain memcg stock on force_empty Shakeel Butt
@ 2018-05-07 20:19 ` Shakeel Butt
  2018-05-09  8:18 ` Michal Hocko
  1 sibling, 0 replies; 3+ messages in thread
From: Shakeel Butt @ 2018-05-07 20:19 UTC (permalink / raw)
  To: Michal Hocko, Andrew Morton, Greg Thelen, Johannes Weiner,
	Vladimir Davydov
  Cc: Linux MM, Cgroups, LKML, Junaid Shahid, Junaid Shahid

On Mon, May 7, 2018 at 1:16 PM Shakeel Butt <shakeelb@google.com> wrote:

> From: Junaid Shahid <junaids@google.com>

> The per-cpu memcg stock can retain a charge of upto 32 pages. On a
> machine with large number of cpus, this can amount to a decent amount
> of memory. Additionally force_empty interface might be triggering
> unneeded memcg reclaims.

> Signed-off-by: Junaid Shahid <juanids@google.com>

This should be "Junaid Shahid <junaids@google.com>".

> Signed-off-by: Shakeel Butt <shakeelb@google.com>
> ---
>   mm/memcontrol.c | 3 +++
>   1 file changed, 3 insertions(+)

> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index e2d33a37f971..2c3c69524b49 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2841,6 +2841,9 @@ static int mem_cgroup_force_empty(struct mem_cgroup
*memcg)

>          /* we call try-to-free pages for make this cgroup empty */
>          lru_add_drain_all();
> +
> +       drain_all_stock(memcg);
> +
>          /* try to free all pages in this cgroup */
>          while (nr_retries && page_counter_read(&memcg->memory)) {
>                  int progress;
> --
> 2.17.0.441.gb46fe60e1d-goog

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

* Re: [PATCH] mm: memcontrol: drain memcg stock on force_empty
  2018-05-07 20:16 [PATCH] mm: memcontrol: drain memcg stock on force_empty Shakeel Butt
  2018-05-07 20:19 ` Shakeel Butt
@ 2018-05-09  8:18 ` Michal Hocko
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2018-05-09  8:18 UTC (permalink / raw)
  To: Shakeel Butt
  Cc: Andrew Morton, Greg Thelen, Johannes Weiner, Vladimir Davydov,
	Linux MM, Cgroups, LKML, Junaid Shahid, Junaid Shahid

On Mon 07-05-18 13:16:51, Shakeel Butt wrote:
> From: Junaid Shahid <junaids@google.com>
> 
> The per-cpu memcg stock can retain a charge of upto 32 pages. On a
> machine with large number of cpus, this can amount to a decent amount
> of memory. Additionally force_empty interface might be triggering
> unneeded memcg reclaims.
> 
> Signed-off-by: Junaid Shahid <juanids@google.com>
> Signed-off-by: Shakeel Butt <shakeelb@google.com>

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

> ---
>  mm/memcontrol.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index e2d33a37f971..2c3c69524b49 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2841,6 +2841,9 @@ static int mem_cgroup_force_empty(struct mem_cgroup *memcg)
>  
>  	/* we call try-to-free pages for make this cgroup empty */
>  	lru_add_drain_all();
> +
> +	drain_all_stock(memcg);
> +
>  	/* try to free all pages in this cgroup */
>  	while (nr_retries && page_counter_read(&memcg->memory)) {
>  		int progress;
> -- 
> 2.17.0.441.gb46fe60e1d-goog

-- 
Michal Hocko
SUSE Labs

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

end of thread, other threads:[~2018-05-09  8:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-07 20:16 [PATCH] mm: memcontrol: drain memcg stock on force_empty Shakeel Butt
2018-05-07 20:19 ` Shakeel Butt
2018-05-09  8:18 ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).