Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp732427rwb; Tue, 27 Sep 2022 04:03:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+2bCMjbvNUxWZOPm35K9lixz3Rj5zxiH11ei2royW88VIhGZXtPw12aNk6HoSiul7ruIA X-Received: by 2002:a63:a64:0:b0:43c:22f8:bd76 with SMTP id z36-20020a630a64000000b0043c22f8bd76mr22239001pgk.378.1664276604902; Tue, 27 Sep 2022 04:03:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664276604; cv=none; d=google.com; s=arc-20160816; b=h/shOMR0Azo+vRPXPA0HGsebSBOZ42PEKsLyckLBK+jMC+MhZbR2Iwvz8Ek+xJxzVM DjPmcJuYUFx9CgRir2O5OMInK613j0wqlo3pmn2D6BZcDO8L6LCb0WB1Yllvws6dSspT z70XRyq2b9O2AOylyEKCeN7U3dtTM4urX2xWiAe+1VnwKF4Q/0sGJZo5mApPZ93k6k/h plTVTTcfcvlORhnGY9kvEpOIliRMliMjvnEC+65p+DWv6fcSP7b3heck6RZOtClPB5Y6 xTnSTjDcEcoCL4o6qd8jxz1choapAYl1r7dkNlzpF4xXEXkZJi4XysZ+OIzfVbzXEFzI +wqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=i6xx2pDMM+ys6Zx/lB+6DFMUvSYuAXEKjSAfUdREPy0=; b=CcvRtJRIrqRmtkI9yX1Sc0l41OkiIhBwrrARI2ui3Y63oD4K/+rtMtRhzUDdH9gWX5 /LdwXSC26nqdgeXzhNRPl9PxjLOGH1pfimIEmdM+D15nHVVI5UaaOD7pt1CnhSH8wCAq C1U5o+V02SmOa4TwMonPo0BvlQYjnG49gKMBZskeCNoBTW7sJpD7RBoIhK8yWjP0v/M9 aRGLQy+8N2K3Lh7cNADVDplK1ga05sBYzgVxCg+PCpNRolddTY3KCLKswwbFkKUO6S8Z fzRbUzOvFGO78ZORRoATk/1x8hYSps1Jm1+Kf94Oi/9oG4eR3jcBGr/foxVqW3cH1iC1 LAfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SzSGGrMb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m75-20020a633f4e000000b0041a77ebb731si1559024pga.294.2022.09.27.04.03.12; Tue, 27 Sep 2022 04:03:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SzSGGrMb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231627AbiI0KCf (ORCPT + 99 others); Tue, 27 Sep 2022 06:02:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231604AbiI0KCa (ORCPT ); Tue, 27 Sep 2022 06:02:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55076956AF; Tue, 27 Sep 2022 03:02:29 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id E5C1861793; Tue, 27 Sep 2022 10:02:28 +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 X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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);