All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
	"bsingharora@gmail.com" <bsingharora@gmail.com>,
	Michal Hocko <mhocko@suse.cz>, Ying Han <yinghan@google.com>
Subject: Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
Date: Thu, 30 Jun 2011 13:01:34 -0700	[thread overview]
Message-ID: <20110630130134.63a1dd37.akpm@linux-foundation.org> (raw)
In-Reply-To: <20110629190325.28aa2dc6.kamezawa.hiroyu@jp.fujitsu.com>

On Wed, 29 Jun 2011 19:03:25 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

> Each memory cgroup has 'swappiness' value and it can be accessed by
> get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> and swappiness is passed by argument. It's propagated by scan_control.
> 
> get_swappiness is static function but some planned updates will need to
> get swappiness from files other than memcontrol.c
> This patch exports get_swappiness() as mem_cgroup_swappiness().
> By this, we can remove the argument of swapiness from try_to_free...
> and drop swappiness from scan_control. only memcg uses it.

x86_64 allnoconfig (aka Documentation/SubmitChecklist, section 2b):

mm/vmscan.c: In function 'vmscan_swappiness':
mm/vmscan.c:1734: error: implicit declaration of function 'mem_cgroup_swappiness'

This is pretty broken.  I think we do want to implement this for
CONFIG_CGROUP_MEM_RES_CTLR=y, CONFIG_SWAP=n:

--- a/include/linux/swap.h~memcg-export-memory-cgroups-swappiness-fix
+++ a/include/linux/swap.h
@@ -365,17 +365,12 @@ static inline void put_swap_token(struct
 extern void
 mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
 extern int mem_cgroup_count_swap_user(swp_entry_t ent, struct page **pagep);
-extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
 #else
 static inline void
 mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
 {
 }
 
-static inline unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem)
-{
-	return vm_swappiness;
-}
 #endif
 #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
 extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
@@ -510,5 +505,15 @@ mem_cgroup_count_swap_user(swp_entry_t e
 #endif
 
 #endif /* CONFIG_SWAP */
+
+#ifdef CONFIG_CGROUP_MEM_RES_CTLR
+extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
+#else
+static inline unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem)
+{
+	return vm_swappiness;
+}
+#endif
+
 #endif /* __KERNEL__*/
 #endif /* _LINUX_SWAP_H */

But what is the role of CONFIG_CGROUP_MEM_RES_CTLR_SWAP?

And in the above circumstances, vmscan_swappiness() devolves into

static int vmscan_swappiness(struct scan_control *sc)
{
       if (scanning_global_lru(sc))
               return vm_swappiness;
       return vm_swappiness;
}

which I guess makes sense but seems a bit odd.

Anyway, my confidence level is low so I think I'll drop this patch. 
Please have a think about the interplay between
CONFIG_CGROUP_MEM_RES_CTLR, CONFIG_CGROUP_MEM_RES_CTLR_SWAP and
CONFIG_SWAP.



WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
	"bsingharora@gmail.com" <bsingharora@gmail.com>,
	Michal Hocko <mhocko@suse.cz>, Ying Han <yinghan@google.com>
Subject: Re: [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2
Date: Thu, 30 Jun 2011 13:01:34 -0700	[thread overview]
Message-ID: <20110630130134.63a1dd37.akpm@linux-foundation.org> (raw)
In-Reply-To: <20110629190325.28aa2dc6.kamezawa.hiroyu@jp.fujitsu.com>

On Wed, 29 Jun 2011 19:03:25 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

> Each memory cgroup has 'swappiness' value and it can be accessed by
> get_swappiness(memcg). The major user is try_to_free_mem_cgroup_pages()
> and swappiness is passed by argument. It's propagated by scan_control.
> 
> get_swappiness is static function but some planned updates will need to
> get swappiness from files other than memcontrol.c
> This patch exports get_swappiness() as mem_cgroup_swappiness().
> By this, we can remove the argument of swapiness from try_to_free...
> and drop swappiness from scan_control. only memcg uses it.

x86_64 allnoconfig (aka Documentation/SubmitChecklist, section 2b):

mm/vmscan.c: In function 'vmscan_swappiness':
mm/vmscan.c:1734: error: implicit declaration of function 'mem_cgroup_swappiness'

This is pretty broken.  I think we do want to implement this for
CONFIG_CGROUP_MEM_RES_CTLR=y, CONFIG_SWAP=n:

--- a/include/linux/swap.h~memcg-export-memory-cgroups-swappiness-fix
+++ a/include/linux/swap.h
@@ -365,17 +365,12 @@ static inline void put_swap_token(struct
 extern void
 mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
 extern int mem_cgroup_count_swap_user(swp_entry_t ent, struct page **pagep);
-extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
 #else
 static inline void
 mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
 {
 }
 
-static inline unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem)
-{
-	return vm_swappiness;
-}
 #endif
 #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
 extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
@@ -510,5 +505,15 @@ mem_cgroup_count_swap_user(swp_entry_t e
 #endif
 
 #endif /* CONFIG_SWAP */
+
+#ifdef CONFIG_CGROUP_MEM_RES_CTLR
+extern unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem);
+#else
+static inline unsigned int mem_cgroup_swappiness(struct mem_cgroup *mem)
+{
+	return vm_swappiness;
+}
+#endif
+
 #endif /* __KERNEL__*/
 #endif /* _LINUX_SWAP_H */

But what is the role of CONFIG_CGROUP_MEM_RES_CTLR_SWAP?

And in the above circumstances, vmscan_swappiness() devolves into

static int vmscan_swappiness(struct scan_control *sc)
{
       if (scanning_global_lru(sc))
               return vm_swappiness;
       return vm_swappiness;
}

which I guess makes sense but seems a bit odd.

Anyway, my confidence level is low so I think I'll drop this patch. 
Please have a think about the interplay between
CONFIG_CGROUP_MEM_RES_CTLR, CONFIG_CGROUP_MEM_RES_CTLR_SWAP and
CONFIG_SWAP.


--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2011-06-30 20:01 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-29 10:03 [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v2 KAMEZAWA Hiroyuki
2011-06-29 10:03 ` KAMEZAWA Hiroyuki
2011-06-29 12:20 ` Michal Hocko
2011-06-29 12:20   ` Michal Hocko
2011-06-29 13:00 ` Balbir Singh
2011-06-29 13:00   ` Balbir Singh
2011-06-29 20:00 ` Andrew Morton
2011-06-29 20:00   ` Andrew Morton
2011-06-30  3:32   ` KAMEZAWA Hiroyuki
2011-06-30  3:32     ` KAMEZAWA Hiroyuki
2011-06-30  6:32     ` Michal Hocko
2011-06-30  6:32       ` Michal Hocko
2011-06-30  7:10       ` KAMEZAWA Hiroyuki
2011-06-30  7:10         ` KAMEZAWA Hiroyuki
2011-06-30  7:33         ` Michal Hocko
2011-06-30  7:33           ` Michal Hocko
2011-06-30 20:01 ` Andrew Morton [this message]
2011-06-30 20:01   ` Andrew Morton
2011-06-30 23:50   ` KAMEZAWA Hiroyuki
2011-06-30 23:50     ` KAMEZAWA Hiroyuki
2011-07-01  0:20     ` KAMEZAWA Hiroyuki
2011-07-01  0:20       ` KAMEZAWA Hiroyuki
2011-07-01  1:06       ` Andrew Morton
2011-07-01  1:06         ` Andrew Morton
2011-07-01  1:16         ` KAMEZAWA Hiroyuki
2011-07-01  1:16           ` KAMEZAWA Hiroyuki
2011-07-01  1:30           ` KAMEZAWA Hiroyuki
2011-07-01  1:30             ` KAMEZAWA Hiroyuki
2011-07-01  7:10             ` KAMEZAWA Hiroyuki
2011-07-01  7:10               ` KAMEZAWA Hiroyuki
2011-07-06  5:18               ` [PATCH] [Cleanup] memcg: export memory cgroup's swappiness v5 KAMEZAWA Hiroyuki
2011-07-06  5:18                 ` 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=20110630130134.63a1dd37.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=bsingharora@gmail.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=nishimura@mxp.nes.nec.co.jp \
    --cc=yinghan@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.