All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Michal Hocko <mhocko@suse.com>,
	Vladimir Davydov <vdavydov@virtuozzo.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 4.4 13/35] mm: memcontrol: avoid unused function warning
Date: Thu, 16 Mar 2017 23:29:32 +0900	[thread overview]
Message-ID: <20170316142907.601154068@linuxfoundation.org> (raw)
In-Reply-To: <20170316142906.685052998@linuxfoundation.org>

4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Arnd Bergmann <arnd@arndb.de>

commit 358c07fcc3b60ab08d77f1684de8bd81bcf49a1a upstream.

A bugfix in v4.8-rc2 introduced a harmless warning when
CONFIG_MEMCG_SWAP is disabled but CONFIG_MEMCG is enabled:

  mm/memcontrol.c:4085:27: error: 'mem_cgroup_id_get_online' defined but not used [-Werror=unused-function]
   static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)

This moves the function inside of the #ifdef block that hides the
calling function, to avoid the warning.

Fixes: 1f47b61fb407 ("mm: memcontrol: fix swap counter leak on swapout from offline cgroup")
Link: http://lkml.kernel.org/r/20160824113733.2776701-1-arnd@arndb.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 mm/memcontrol.c |   36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4150,24 +4150,6 @@ static void mem_cgroup_id_get_many(struc
 	atomic_add(n, &memcg->id.ref);
 }
 
-static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)
-{
-	while (!atomic_inc_not_zero(&memcg->id.ref)) {
-		/*
-		 * The root cgroup cannot be destroyed, so it's refcount must
-		 * always be >= 1.
-		 */
-		if (WARN_ON_ONCE(memcg == root_mem_cgroup)) {
-			VM_BUG_ON(1);
-			break;
-		}
-		memcg = parent_mem_cgroup(memcg);
-		if (!memcg)
-			memcg = root_mem_cgroup;
-	}
-	return memcg;
-}
-
 static void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n)
 {
 	if (atomic_sub_and_test(n, &memcg->id.ref)) {
@@ -5751,6 +5733,24 @@ static int __init mem_cgroup_init(void)
 subsys_initcall(mem_cgroup_init);
 
 #ifdef CONFIG_MEMCG_SWAP
+static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)
+{
+	while (!atomic_inc_not_zero(&memcg->id.ref)) {
+		/*
+		 * The root cgroup cannot be destroyed, so it's refcount must
+		 * always be >= 1.
+		 */
+		if (WARN_ON_ONCE(memcg == root_mem_cgroup)) {
+			VM_BUG_ON(1);
+			break;
+		}
+		memcg = parent_mem_cgroup(memcg);
+		if (!memcg)
+			memcg = root_mem_cgroup;
+	}
+	return memcg;
+}
+
 /**
  * mem_cgroup_swapout - transfer a memsw charge to swap
  * @page: page whose memsw charge to transfer

  parent reply	other threads:[~2017-03-16 14:37 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-16 14:29 [PATCH 4.4 00/35] 4.4.55-stable review Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 01/35] USB: serial: digi_acceleport: fix OOB data sanity check Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 02/35] USB: serial: digi_acceleport: fix OOB-event processing Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 03/35] crypto: improve gcc optimization flags for serpent and wp512 Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 04/35] MIPS: Update defconfigs for NF_CT_PROTO_DCCP/UDPLITE change Greg Kroah-Hartman
2017-03-19 16:05   ` Ben Hutchings
2017-03-20 10:03     ` Ralf Baechle
2017-03-20 10:03       ` Ralf Baechle
2017-03-20 10:30     ` Greg Kroah-Hartman
2017-03-20 10:30       ` Greg Kroah-Hartman
2017-03-20 10:42       ` Arnd Bergmann
2017-03-20 16:29         ` Greg Kroah-Hartman
2017-03-20 16:43           ` Ralf Baechle
2017-03-16 14:29 ` [PATCH 4.4 05/35] MIPS: ip27: Disable qlge driver in defconfig Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 06/35] MIPS: Update ip27_defconfig for SCSI_DH change Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 07/35] MIPS: ip22: Fix ip28 build for modern gcc Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 08/35] MIPS: Update lemote2f_defconfig for CPU_FREQ_STAT change Greg Kroah-Hartman
2017-03-19 16:06   ` Ben Hutchings
2017-03-20 10:15     ` Ralf Baechle
2017-03-20 10:15       ` Ralf Baechle
2017-03-20 16:29       ` Greg Kroah-Hartman
2017-03-20 16:29         ` Greg Kroah-Hartman
2017-03-20 16:50         ` Ralf Baechle
2017-03-20 17:34           ` Greg Kroah-Hartman
2017-03-20 10:31     ` Greg Kroah-Hartman
2017-03-20 10:31       ` Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 09/35] mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 10/35] MIPS: ralink: Cosmetic change to prom_init() Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 11/35] MIPS: ralink: Remove unused rt*_wdt_reset functions Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 12/35] cpmac: remove hopeless #warning Greg Kroah-Hartman
2017-03-16 14:29 ` Greg Kroah-Hartman [this message]
2017-03-16 14:29 ` [PATCH 4.4 14/35] MIPS: DEC: Avoid la pseudo-instruction in delay slots Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 15/35] MIPS: Netlogic: Fix CP0_EBASE redefinition warnings Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 16/35] tracing: Add #undef to fix compile error Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 17/35] powerpc: Emulation support for load/store instructions on LE Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 18/35] usb: gadget: dummy_hcd: clear usb_gadget region before registration Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 19/35] usb: dwc3: gadget: make Set Endpoint Configuration macros safe Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 20/35] usb: gadget: function: f_fs: pass companion descriptor along Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 21/35] usb: host: xhci-dbg: HCIVERSION should be a binary number Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 22/35] usb: host: xhci-plat: Fix timeout on removal of hot pluggable xhci controllers Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 23/35] USB: serial: safe_serial: fix information leak in completion handler Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 24/35] USB: serial: omninet: fix reference leaks at open Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 25/35] USB: iowarrior: fix NULL-deref at probe Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 26/35] USB: iowarrior: fix NULL-deref in write Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 27/35] USB: serial: io_ti: fix NULL-deref in interrupt callback Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 28/35] USB: serial: io_ti: fix information leak in completion handler Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 30/35] mvsas: fix misleading indentation Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 31/35] KVM: s390: Fix guest migration for huge guests resulting in panic Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 32/35] s390/kdump: Use "LINUX" ELF note name instead of "CORE" Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 33/35] nfit, libnvdimm: fix interleave set cookie calculation Greg Kroah-Hartman
2017-03-19 16:38   ` Ben Hutchings
2017-03-20 17:55     ` Dan Williams
2017-03-16 14:29 ` [PATCH 4.4 34/35] dm: flush queued bios when process blocks to avoid deadlock Greg Kroah-Hartman
2017-03-16 14:29 ` [PATCH 4.4 35/35] ext4: dont BUG when truncating encrypted inodes on the orphan list Greg Kroah-Hartman
2017-03-16 19:20 ` [PATCH 4.4 00/35] 4.4.55-stable review Shuah Khan
2017-03-16 22:36 ` Guenter Roeck

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=20170316142907.601154068@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=vdavydov@virtuozzo.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.