From patchwork Mon Jul 8 12:41:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 168623 Delivered-To: patch@linaro.org Received: by 2002:ac9:6410:0:0:0:0:0 with SMTP id r16csp6502145ock; Mon, 8 Jul 2019 05:42:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYiMQ2CFbLVJms97oIZXQYRKSPkQ4VqSolAiHTRmFxaNaiJiR0W56crZdP8YYFhI2C/F0E X-Received: by 2002:a63:7a06:: with SMTP id v6mr23706578pgc.115.1562589743191; Mon, 08 Jul 2019 05:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562589743; cv=none; d=google.com; s=arc-20160816; b=a39INZrHKvVs2JlWLUtW2UPde2moXlYIuWkjUc2oqECCdTO5c6hO+E1edbd7Gnuj1g LgGYbsZkgBrloSS7XvdOncZ2h09ohN82TR2g9UesF/h6K6T0yVUYj4Sgi8IJ5eaTbmD5 pWuk89f8xOfww9p1QOWiOfafrkPsRgisXKBNNi38Td18DYSTLaPvLel9lI+/HycpY4ex aoWgN3VJ0/tZlw6dutDb5k7rv1WERd2C/Pk+U9mSPhVRUUb2g3z7YFfHLbUAdlyGAWTY jphBIYq/dm3BQ0JD4SPOAG80qW0g4VRqAYV4Uuzp1YsoeaVuJOfVzX7GOfOGKo0ZwmaD G3Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from; bh=I0ID9b0H+zcj5NnrvpKFC0Y/+i8u3r5flC2mQlpHLJU=; b=n58dZ2c1dEKJRMplmS2w8zkkS1dzcl5xENj+mvU5Kju1E11UkjncGwux6NcRGkeAwG 0Z4ett66K+ZGqWsedatt86hoCVXdS2Ub6H80D3bOmng8Bu3muyrxDKoJukEg+J8elQgj YMWao+HipQKnASdgXq0NThg9mgLav56NPnq5Jmi8w6AQkhLb2Zskoth+hzmeDywdeGV4 qZjN4esYt1o3D26ssvvAntXm+DlwcM49UO1QviTW6U3q2vPPBM5C2qtwKaD0h9puk4ad lpm28PNuYlqSzzoGzrknRyYn+2P5UAOSr9HuCpMCOTdw3JnxrysfBEPM+B7aFVtz2pUl vvEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si11968849pgq.459.2019.07.08.05.42.22; Mon, 08 Jul 2019 05:42:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730879AbfGHMmV (ORCPT + 30 others); Mon, 8 Jul 2019 08:42:21 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:46413 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727065AbfGHMmV (ORCPT ); Mon, 8 Jul 2019 08:42:21 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mduym-1iKMCm2862-00az91; Mon, 08 Jul 2019 14:41:26 +0200 From: Arnd Bergmann Cc: Arnd Bergmann , Yang Shi , "Kirill A. Shutemov" , Kirill Tkhai , Johannes Weiner , Michal Hocko , Hugh Dickins , Shakeel Butt , David Rientjes , Andrew Morton , Stephen Rothwell , Roman Gushchin , Chris Down , Yafang Shao , Mel Gorman , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH] vmscan: fix memcg_kmem build failure Date: Mon, 8 Jul 2019 14:41:03 +0200 Message-Id: <20190708124120.3400683-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:8VkSE5EXRvXhg4WTtl1yfmQwLxnuqIVBWC3O64OvYEpHsptKShz liGdVTsfLuFY0hhVyQVWbff5R3bnb6E1HJhu20u8pAvj9sk57oG0RsiWEA+A1bIP/Uugd9q 2kMCOc7ttYjFkbS/CznPsTeFSIM1mWM86j4G6IquKv0/qHs1LJEQyDFHh4E7ePwwl6mD2aj jfri59CV9WSdBmPT0jJfA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:BR6pqYPidxU=:IRaEjSZOktumWrt9EMStya IX38wDJ+IcfvW5pYQ44mrAN4pOG+fQBfdEpJjdSIiZkiiXgMWlz9OIiqV5DdcIp1mHsdwhTA9 rtdTNxE957ciTEuUFcKJ3CMh6m/HMNfwb9KVY+QAVUGrwqr3ACpvagXxvl8xUcs3nevzRuERn rW0cF4laMbGlGWPzYD/E+eKlXk/TJDTKR8xGf4VfXa6DO4goKEHDJ1sKXj+o0I+QPV9ZbBJoH i96a7Zpg6KHtjYR7CkgUCmcwVzdkpAidWvro3JmDTPB/Xpm8XSLkJRoRUTO+qOld4Gt1YN0KO TPv5QgcYo34HcdMQppjFYyVe35Tn4bslNyZlESRD4UHV6zcUhDfgAIWd4Yc58B4hBFi7NNefD bw3ai4opAWaOE+iE2O5tMhwrPgKUpcy+xnCLPA4f4mTZf8VUaix5mzL4Rf0qotuQAbjPIosJ8 zHTUCS0DxAJ4YTGxlKa9IWbst0+jW6ydHXPf+rZhQhlkLfSx3oHdSNaAaYGLwZG0998vvn7EP zrba2rn2a2fSR0fyAD5KSxXfoVqQfL413Q9mnGnKlTIWGrU6R/L7KPzHiSi761jL2euFRRVES effFfk1ECatHuTe8ZS7Ub5HMvBajqf0re1k1O9S3vlL+AbwNzwhAyXbCHpJ4gl04+uOvzzLhJ QWf7Y6snVpnfNAu3wMawsKQjVoz3bb4dDGiCEMKdpV+eZRnJnSmHlCIGpER7rTpkmEAPExn5c tdmnEbVumZyGVWj5RoAWRbXyX4mivgOuqISEGg== To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When CONFIG_MEMCG_KMEM is disabled, we get a build failure for calling a nonexisting memcg_expand_shrinker_maps(): mm/vmscan.c:220:7: error: implicit declaration of function 'memcg_expand_shrinker_maps' [-Werror,-Wimplicit-function-declaration] if (memcg_expand_shrinker_maps(id)) { ^ mm/vmscan.c:220:7: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] mm/vmscan.c:608:56: error: no member named 'shrinker_map' in 'struct mem_cgroup_per_node' map = rcu_dereference_protected(memcg->nodeinfo[nid]->shrinker_map, ~~~~~~~~~~~~~~~~~~~~ ^ include/linux/rcupdate.h:498:31: note: expanded from macro 'rcu_dereference_protected' __rcu_dereference_protected((p), (c), __rcu) ^ include/linux/rcupdate.h:321:12: note: expanded from macro '__rcu_dereference_protected' ((typeof(*p) __force __kernel *)(p)); \ ^ mm/vmscan.c:608:6: error: assigning to 'struct memcg_shrinker_map *' from incompatible type 'void' map = rcu_dereference_protected(memcg->nodeinfo[nid]->shrinker_map, and another issue trying to access invalid struct fields: mm/vmscan.c:608:56: error: no member named 'shrinker_map' in 'struct mem_cgroup_per_node' map = rcu_dereference_protected(memcg->nodeinfo[nid]->shrinker_map, ~~~~~~~~~~~~~~~~~~~~ ^ include/linux/rcupdate.h:498:31: note: expanded from macro 'rcu_dereference_protected' __rcu_dereference_protected((p), (c), __rcu) ^ include/linux/rcupdate.h:321:12: note: expanded from macro '__rcu_dereference_protected' ((typeof(*p) __force __kernel *)(p)); \ ^ mm/vmscan.c:608:6: error: assigning to 'struct memcg_shrinker_map *' from incompatible type 'void' map = rcu_dereference_protected(memcg->nodeinfo[nid]->shrinker_map, Add a dummy definition for memcg_expand_shrinker_maps() that always fails, and hide the obviously nonworking shrink_slab_memcg() function. Fixes: 8236f517d69e ("mm: shrinker: make shrinker not depend on memcg kmem") Signed-off-by: Arnd Bergmann --- No idea what the intended behavior is supposed to be for this case. Rather than failing, should we actually provide that function? Or maybe a more elaborate change is needed? --- include/linux/memcontrol.h | 5 +++++ mm/vmscan.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) -- 2.20.0 diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 5901a90f58eb..6b15e2066fc7 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1407,6 +1407,11 @@ static inline void memcg_put_cache_ids(void) { } +static inline int memcg_expand_shrinker_maps(int new_id) +{ + return -ENOMEM; +} + static inline void memcg_set_shrinker_bit(struct mem_cgroup *memcg, int nid, int shrinker_id) { } #endif /* CONFIG_MEMCG_KMEM */ diff --git a/mm/vmscan.c b/mm/vmscan.c index a0301edd8d03..323a9c50c0fe 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -591,7 +591,7 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, return freed; } -#ifdef CONFIG_MEMCG +#ifdef CONFIG_MEMCG_KMEM static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int nid, struct mem_cgroup *memcg, int priority) {