linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, netdev@vger.kernel.org,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mm: memcontrol: only manage socket pressure for CONFIG_INET
Date: Wed, 09 Dec 2015 17:32:16 +0100	[thread overview]
Message-ID: <7343206.sFybcLLUN2@wuerfel> (raw)
In-Reply-To: <2564892.qO1q7YJ6Nb@wuerfel>

When IPV4 support is disabled, the memcg->socket_pressure field is
not defined and we get a build error from the vmpressure code:

mm/vmpressure.c: In function 'vmpressure':
mm/vmpressure.c:287:9: error: 'struct mem_cgroup' has no member named 'socket_pressure'
    memcg->socket_pressure = jiffies + HZ;
mm/built-in.o: In function `mem_cgroup_css_free':
:(.text+0x1c03a): undefined reference to `tcp_destroy_cgroup'
mm/built-in.o: In function `mem_cgroup_css_online':
:(.text+0x1c20e): undefined reference to `tcp_init_cgroup'

This puts the code causing this in the same #ifdef that guards the
struct member and the TCP implementation.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 20cc40e66c42 ("mm: memcontrol: hook up vmpressure to socket pressure")

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6faea81e66d7..73cd572167bb 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4220,13 +4220,13 @@ mem_cgroup_css_online(struct cgroup_subsys_state *css)
 	if (ret)
 		return ret;
 
+#ifdef CONFIG_INET
 #ifdef CONFIG_MEMCG_LEGACY_KMEM
 	ret = tcp_init_cgroup(memcg);
 	if (ret)
 		return ret;
 #endif
 
-#ifdef CONFIG_INET
 	if (cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgroup_memory_nosocket)
 		static_branch_inc(&memcg_sockets_enabled_key);
 #endif
@@ -4276,7 +4276,7 @@ static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
 
 	memcg_free_kmem(memcg);
 
-#ifdef CONFIG_MEMCG_LEGACY_KMEM
+#if defined(CONFIG_MEMCG_LEGACY_KMEM) && defined(CONFIG_INET)
 	tcp_destroy_cgroup(memcg);
 #endif
 
diff --git a/mm/vmpressure.c b/mm/vmpressure.c
index 506f03e4be47..8cdeebe48848 100644
--- a/mm/vmpressure.c
+++ b/mm/vmpressure.c
@@ -275,6 +275,7 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree,
 
 		level = vmpressure_calc_level(scanned, reclaimed);
 
+#ifdef CONFIG_INET
 		if (level > VMPRESSURE_LOW) {
 			/*
 			 * Let the socket buffer allocator know that
@@ -286,6 +287,7 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree,
 			 */
 			memcg->socket_pressure = jiffies + HZ;
 		}
+#endif
 	}
 }
 


  reply	other threads:[~2015-12-09 16:32 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08 15:30 [PATCH 00/14] mm: memcontrol: account socket memory in unified hierarchy v4-RESEND Johannes Weiner
2015-12-08 15:30 ` [PATCH 01/14] mm: memcontrol: export root_mem_cgroup Johannes Weiner
2015-12-08 15:30 ` [PATCH 02/14] net: tcp_memcontrol: properly detect ancestor socket pressure Johannes Weiner
2015-12-08 15:30 ` [PATCH 03/14] net: tcp_memcontrol: remove bogus hierarchy pressure propagation Johannes Weiner
2015-12-08 15:30 ` [PATCH 04/14] net: tcp_memcontrol: protect all tcp_memcontrol calls by jump-label Johannes Weiner
2015-12-08 15:30 ` [PATCH 05/14] net: tcp_memcontrol: remove dead per-memcg count of allocated sockets Johannes Weiner
2015-12-08 15:30 ` [PATCH 06/14] net: tcp_memcontrol: simplify the per-memcg limit access Johannes Weiner
2015-12-08 15:30 ` [PATCH 07/14] net: tcp_memcontrol: sanitize tcp memory accounting callbacks Johannes Weiner
2015-12-08 15:30 ` [PATCH 08/14] net: tcp_memcontrol: simplify linkage between socket and page counter Johannes Weiner
2015-12-08 15:30 ` [PATCH 09/14] mm: memcontrol: generalize the socket accounting jump label Johannes Weiner
2015-12-08 15:30 ` [PATCH 10/14] mm: memcontrol: do not account memory+swap on unified hierarchy Johannes Weiner
2015-12-08 15:30 ` [PATCH 11/14] mm: memcontrol: move socket code for unified hierarchy accounting Johannes Weiner
2015-12-08 15:30 ` [PATCH 12/14] mm: memcontrol: account socket memory in unified hierarchy memory controller Johannes Weiner
2015-12-15 19:50   ` Michal Hocko
2015-12-08 15:30 ` [PATCH 13/14] mm: memcontrol: hook up vmpressure to socket pressure Johannes Weiner
2015-12-08 15:30 ` [PATCH 14/14] mm: memcontrol: switch to the updated jump-label API Johannes Weiner
2015-12-08 16:28   ` David Miller
2015-12-08 16:28 ` [PATCH 00/14] mm: memcontrol: account socket memory in unified hierarchy v4-RESEND David Miller
2015-12-09 16:31 ` Arnd Bergmann
2015-12-09 16:32   ` Arnd Bergmann [this message]
2015-12-09 18:58     ` [PATCH] mm: memcontrol: only manage socket pressure for CONFIG_INET Johannes Weiner
2015-12-09 22:28       ` Andrew Morton
2015-12-09 23:05         ` Johannes Weiner
2015-12-09 23:13           ` Andrew Morton
2016-01-22  3:25             ` Masanari Iida
2015-12-09 16:32   ` [PATCH] mm: memcontrol: MEMCG no longer works with SLOB Arnd Bergmann
2015-12-09 20:01     ` Johannes Weiner
2015-12-09 21:03       ` Arnd Bergmann
2015-12-10 11:24       ` Vladimir Davydov
2015-12-09 18:17   ` [PATCH 00/14] mm: memcontrol: account socket memory in unified hierarchy v4-RESEND Johannes Weiner

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=7343206.sFybcLLUN2@wuerfel \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).