mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Pekka Enberg" <penberg@cs.helsinki.fi>
To: "KOSAKI Motohiro" <kosaki.motohiro@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Balbir Singh" <balbir@linux.vnet.ibm.com>,
	"KAMEZAWA Hiroyuki" <kamezawa.hiroyu@jp.fujitsu.com>,
	"Rik van Riel" <riel@redhat.com>
Subject: Re: [PATCH 02/09] memcg: make inactive_anon_is_low()
Date: Sun, 30 Nov 2008 14:50:24 +0200	[thread overview]
Message-ID: <84144f020811300450m7f450a1eue9ee820db2022ca5@mail.gmail.com> (raw)
In-Reply-To: <20081130195508.814B.KOSAKI.MOTOHIRO@jp.fujitsu.com>

On Sun, Nov 30, 2008 at 12:56 PM, KOSAKI Motohiro
<kosaki.motohiro@jp.fujitsu.com> wrote:
> make inactive_anon_is_low for memcgroup.
> it improve active_anon vs inactive_anon ratio balancing.

The subject line of this patch seems to be truncated and the changelog
seems bit terse. While the change may be obvious to memcg developers,
it's not for the casual reader.

>
>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> ---
>  include/linux/memcontrol.h |   10 ++++++++++
>  mm/memcontrol.c            |   38 +++++++++++++++++++++++++++++++++++++-
>  mm/vmscan.c                |   36 +++++++++++++++++++++++-------------
>  3 files changed, 70 insertions(+), 14 deletions(-)
>
> Index: b/include/linux/memcontrol.h
> ===================================================================
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -90,6 +90,8 @@ extern void mem_cgroup_record_reclaim_pr
>
>  extern long mem_cgroup_calc_reclaim(struct mem_cgroup *mem, struct zone *zone,
>                                        int priority, enum lru_list lru);
> +int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg,
> +                                   struct zone *zone);
>
>  #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
>  extern int do_swap_account;
> @@ -241,6 +243,14 @@ static inline bool mem_cgroup_oom_called
>  {
>        return false;
>  }
> +
> +static inline int
> +mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg, struct zone *zone)
> +{
> +       return 1;
> +}
> +
> +

An extra newline here.

>  #endif /* CONFIG_CGROUP_MEM_CONT */
>
>  #endif /* _LINUX_MEMCONTROL_H */
> Index: b/mm/memcontrol.c
> ===================================================================
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -156,6 +156,9 @@ struct mem_cgroup {
>        unsigned long   last_oom_jiffies;
>        int             obsolete;
>        atomic_t        refcnt;
> +
> +       int inactive_ratio;
> +

Is there a reason why this is not unsigned long? A comment here
explaining what ->inactive_ratio is used for would be nice.

> +static void mem_cgroup_set_inactive_ratio(struct mem_cgroup *memcg)
> +{
> +       unsigned int gb, ratio;
> +
> +       gb = res_counter_read_u64(&memcg->res, RES_LIMIT) >> 30;
> +       ratio = int_sqrt(10 * gb);

You might want to consider adding a comment explaining what the above
calculation is supposed to be doing.

> +       if (!ratio)
> +               ratio = 1;
> +
> +       memcg->inactive_ratio = ratio;
> +
> +}
> +
>  static DEFINE_MUTEX(set_limit_mutex);
>
>  static int mem_cgroup_resize_limit(struct mem_cgroup *memcg,
> @@ -1381,6 +1411,11 @@ static int mem_cgroup_resize_limit(struc
>                                GFP_HIGHUSER_MOVABLE, false);
>                if (!progress)                  retry_count--;
>        }
> +
> +       if (!ret)
> +               mem_cgroup_set_inactive_ratio(memcg);
> +
> +

An extra newline here.

>        return ret;
>  }
>
> @@ -1423,6 +1458,7 @@ int mem_cgroup_resize_memsw_limit(struct
>                if (curusage >= oldusage)
>                        retry_count--;
>        }
> +
>        return ret;
>  }

There's some diff noise here.

  parent reply	other threads:[~2008-11-30 12:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-30 10:54 [PATCH 00/09] memcg: split-lru feature for memcg KOSAKI Motohiro
2008-11-30 10:55 ` [PATCH 01/09] inactive_anon_is_low() move to vmscan.c KOSAKI Motohiro
2008-11-30 15:18   ` Rik van Riel
2008-11-30 10:56 ` [PATCH 02/09] memcg: make inactive_anon_is_low() KOSAKI Motohiro
2008-11-30 12:25   ` Cyrill Gorcunov
2008-11-30 14:00     ` KOSAKI Motohiro
2008-11-30 12:50   ` Pekka Enberg [this message]
2008-11-30 14:04     ` KOSAKI Motohiro
2008-11-30 15:24   ` Rik van Riel
2008-11-30 10:57 ` [PATCH 03/09] introduce zone_reclaim struct KOSAKI Motohiro
2008-11-30 15:27   ` Rik van Riel
2008-11-30 10:59 ` [PATCH 04/09] memcg: make zone_reclaim_stat KOSAKI Motohiro
2008-11-30 16:06   ` Rik van Riel
2008-12-01  0:48     ` KOSAKI Motohiro
2008-11-30 16:08   ` Rik van Riel
2008-12-01  0:50     ` KOSAKI Motohiro
2008-11-30 10:59 ` [PATCH 05/09] make zone_nr_pages() helper function KOSAKI Motohiro
2008-11-30 16:10   ` Rik van Riel
2008-11-30 11:00 ` [PATCH 06/09] make get_scan_ratio() to memcg awareness KOSAKI Motohiro
2008-11-30 11:01 ` [PATCH 07/09] memcg: remove mem_cgroup_calc_reclaim() KOSAKI Motohiro
2008-11-30 11:02 ` [PATCH 08/09] memcg: show inactive_ratio KOSAKI Motohiro
2008-11-30 11:03 ` [PATCH 09/09] memcg: show reclaim stat KOSAKI Motohiro
2008-12-01  2:00 ` [PATCH 00/09] memcg: split-lru feature for memcg KAMEZAWA Hiroyuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=84144f020811300450m7f450a1eue9ee820db2022ca5@mail.gmail.com \
    --to=penberg@cs.helsinki.fi \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®