From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0790DC07E9D for ; Tue, 27 Sep 2022 10:02:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 70FA18E00BE; Tue, 27 Sep 2022 06:02:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6BEB58E00AF; Tue, 27 Sep 2022 06:02:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55F818E00BE; Tue, 27 Sep 2022 06:02:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 44C298E00AF for ; Tue, 27 Sep 2022 06:02:32 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1310FAAB32 for ; Tue, 27 Sep 2022 10:02:32 +0000 (UTC) X-FDA: 79957425744.10.D695466 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf17.hostedemail.com (Postfix) with ESMTP id 84BE840013 for ; Tue, 27 Sep 2022 10:02:31 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9FCD1B81AE4; Tue, 27 Sep 2022 10:02:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 407F0C433D6; Tue, 27 Sep 2022 10:02:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664272948; bh=dlgt8sTUOCFvaKMGVG7jt6xOPr5SYmh1UhVPSKkYzV8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=SzSGGrMbrYCeDjltNrgrL3VG2omylsDXXWGmFRuKYPFnG2Xtt63azHAsuGowYidFD vuXsb1OH/s/KwBRrtO4U7PShzKeRUQ6r0e13xxx6bq+NTHfByi71P4P6tQvc7Z8p1W QQu/R2CHgWE0QRLqrRl6ANwMMZJClkApkeRIMNC7efj90M4T9lKE5uoFewIOEQmM/3 Y6fCSR/7GnG+tEUZB8N1wSz/PUN49XvesX2YiFyZr2dYXU2ZRmA2geaiWFJLkpAPQk H1I6zN0LGrV0YwBi4275HtG2my1Kuu0KK1SzWnQ3lUfAapmKTlFxrXh+RWDZrb4ars KrO+qSy8Z1aVA== Message-ID: <54078150-3c22-3563-7731-5c7fda85987d@kernel.org> Date: Tue, 27 Sep 2022 12:02:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH] Revert "net: set proper memcg for net_init hooks allocations" Content-Language: en-US To: Shakeel Butt , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Andrew Morton Cc: =?UTF-8?Q?Michal_Koutn=c3=bd?= , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Anatoly Pugachev , Vasily Averin , Jakub Kicinski , Linus Torvalds , sparclinux@vger.kernel.org, regressions@lists.linux.dev References: <20220926195931.2497968-1-shakeelb@google.com> From: "Vlastimil Babka (SUSE)" In-Reply-To: <20220926195931.2497968-1-shakeelb@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664272951; a=rsa-sha256; cv=none; b=qSSKrnP40I6m3ahafgei+ZbDvdKYqHtvOsDsDpvcttL0fq7NxMKkz9ifsgBObmBe2nEBJk oAXaOZmxF3Y2FsLkAkcdY0YFRUAGWRR5dlH0KVh6D7fnhjvFx6sXA3MV+XSZdwFO5PQcHZ Sf1QSOu9QqXHWVQr5av9dhl2xQEJELU= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SzSGGrMb; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf17.hostedemail.com: domain of vbabka@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=vbabka@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664272951; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=i6xx2pDMM+ys6Zx/lB+6DFMUvSYuAXEKjSAfUdREPy0=; b=A1StoLQ1/ZRWfzb5zdTAXGXyDwdvgorGVH5egJNyztS+t5rmfhzJxdTEgYHW7a6sMm0ED/ c2AaZuZtd5Q896M/em2C8vL3X2aPvVk9s4RHJGIo0Mg8eZ+7JOFdf6SLvdQ8gDWVMF5Lr2 di+XWxtB++oVa+O4RZ5OBepJeVMBJAM= X-Stat-Signature: sop97mhsesaa8obar4if3zuwcezdepsp X-Rspam-User: X-Rspamd-Server: rspam04 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=SzSGGrMb; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf17.hostedemail.com: domain of vbabka@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=vbabka@kernel.org X-Rspamd-Queue-Id: 84BE840013 X-HE-Tag: 1664272951-629827 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 9/26/22 21:59, Shakeel Butt wrote: > This reverts commit 1d0403d20f6c281cb3d14c5f1db5317caeec48e9. > > Anatoly Pugachev reported that the commit 1d0403d20f6c ("net: set proper > memcg for net_init hooks allocations") is somehow causing the sparc64 > VMs failed to boot and the VMs boot fine with that patch reverted. So, > revert the patch for now and later we can debug the issue. > Link: https://lore.kernel.org/all/20220918092849.GA10314@u164.east.ru/ (mainly for regzbot reading this thread but should be valid usage for the report anyway) Fixes: 1d0403d20f6c ("net: set proper memcg for net_init hooks allocations") > Reported-by: Anatoly Pugachev > Signed-off-by: Shakeel Butt > Cc: Vasily Averin > Cc: Jakub Kicinski > Cc: Michal Koutný > Cc: Andrew Morton > Cc: Linus Torvalds > Cc: cgroups@vger.kernel.org > Cc: sparclinux@vger.kernel.org > Cc: linux-mm@kvack.org > Cc: linux-kernel@vger.kernel.org > --- > include/linux/memcontrol.h | 45 -------------------------------------- > net/core/net_namespace.c | 7 ------ > 2 files changed, 52 deletions(-) > > diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h > index ef479e554253..e1644a24009c 100644 > --- a/include/linux/memcontrol.h > +++ b/include/linux/memcontrol.h > @@ -1787,42 +1787,6 @@ static inline void count_objcg_event(struct obj_cgroup *objcg, > rcu_read_unlock(); > } > > -/** > - * get_mem_cgroup_from_obj - get a memcg associated with passed kernel object. > - * @p: pointer to object from which memcg should be extracted. It can be NULL. > - * > - * Retrieves the memory group into which the memory of the pointed kernel > - * object is accounted. If memcg is found, its reference is taken. > - * If a passed kernel object is uncharged, or if proper memcg cannot be found, > - * as well as if mem_cgroup is disabled, NULL is returned. > - * > - * Return: valid memcg pointer with taken reference or NULL. > - */ > -static inline struct mem_cgroup *get_mem_cgroup_from_obj(void *p) > -{ > - struct mem_cgroup *memcg; > - > - rcu_read_lock(); > - do { > - memcg = mem_cgroup_from_obj(p); > - } while (memcg && !css_tryget(&memcg->css)); > - rcu_read_unlock(); > - return memcg; > -} > - > -/** > - * mem_cgroup_or_root - always returns a pointer to a valid memory cgroup. > - * @memcg: pointer to a valid memory cgroup or NULL. > - * > - * If passed argument is not NULL, returns it without any additional checks > - * and changes. Otherwise, root_mem_cgroup is returned. > - * > - * NOTE: root_mem_cgroup can be NULL during early boot. > - */ > -static inline struct mem_cgroup *mem_cgroup_or_root(struct mem_cgroup *memcg) > -{ > - return memcg ? memcg : root_mem_cgroup; > -} > #else > static inline bool mem_cgroup_kmem_disabled(void) > { > @@ -1879,15 +1843,6 @@ static inline void count_objcg_event(struct obj_cgroup *objcg, > { > } > > -static inline struct mem_cgroup *get_mem_cgroup_from_obj(void *p) > -{ > - return NULL; > -} > - > -static inline struct mem_cgroup *mem_cgroup_or_root(struct mem_cgroup *memcg) > -{ > - return NULL; > -} > #endif /* CONFIG_MEMCG_KMEM */ > > #if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_ZSWAP) > diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c > index 6b9f19122ec1..0ec2f5906a27 100644 > --- a/net/core/net_namespace.c > +++ b/net/core/net_namespace.c > @@ -18,7 +18,6 @@ > #include > #include > #include > -#include > #include > #include > > @@ -1144,13 +1143,7 @@ static int __register_pernet_operations(struct list_head *list, > * setup_net() and cleanup_net() are not possible. > */ > for_each_net(net) { > - struct mem_cgroup *old, *memcg; > - > - memcg = mem_cgroup_or_root(get_mem_cgroup_from_obj(net)); > - old = set_active_memcg(memcg); > error = ops_init(ops, net); > - set_active_memcg(old); > - mem_cgroup_put(memcg); > if (error) > goto out_undo; > list_add_tail(&net->exit_list, &net_exit_list);