From patchwork Mon Sep 26 19:59:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 12989375 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 2B7D1C6FA82 for ; Mon, 26 Sep 2022 20:00:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 649418E0080; Mon, 26 Sep 2022 16:00:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D57D8E0066; Mon, 26 Sep 2022 16:00:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44BD18E0080; Mon, 26 Sep 2022 16:00:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2DF738E0066 for ; Mon, 26 Sep 2022 16:00:07 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 048B51407C7 for ; Mon, 26 Sep 2022 20:00:06 +0000 (UTC) X-FDA: 79955302854.16.10E4433 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) by imf31.hostedemail.com (Postfix) with ESMTP id AFB5D20010 for ; Mon, 26 Sep 2022 20:00:06 +0000 (UTC) Received: by mail-pf1-f202.google.com with SMTP id u10-20020a056a00098a00b00543b3eb6416so4602117pfg.15 for ; Mon, 26 Sep 2022 13:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:from:to:cc:subject:date; bh=u8rmArpPmicN7r7IqqfOH58XS1KpMBR85FAb+1BiVJU=; b=C6QG8W0A2jE6D9CQn2zjFYStoqzefhTb8kQ0+ijebpJ1iSqL6VRR47hdRXsQpQZRVi ZOj5ZWqu7FVHPGLKRJAWVuGzZn23oT10mF9H0WOIU0KpWTD8WN80nUS552n8T4H/yEBZ rMhciPLFY9Je4vstINLc/UQ/85IuMlR7kYYAymiC0v4Hao/DMK81RACr0ZE4nAzyFP9V aD++IHQNCyi0epayDNuUvnT/hxLpafzq+rCUieYLFH+PgLPrllui+HqgROCEF4rQJUne rtqFcIJMzjUQ9VpxXKNRzWBxH1E1W/migdx00pRZO5ak5EfRPMTN54xKK0uC98ljG4IJ g71g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:x-gm-message-state:from:to:cc:subject:date; bh=u8rmArpPmicN7r7IqqfOH58XS1KpMBR85FAb+1BiVJU=; b=MNCXFOjNHwO5gJ+G7bJZaG2c1dI4LRPDLnIDvlSeFMe1czg6gC7plX65D56jdhm2LV S1Qe40XiuAu+9Tgci0xALfzQPtWYmNne+i00gjL55R6wpIrT1vZ6eZctt3LWRpzcAJal 2i6lhl4HLUi6GwRy+Z+FZmiks40/9QAMOxoq63sQoa5jnehY8HU8bWuYI+uH7J+mVU3T h+GZyxtQX3Io1ZiwgD7HNpRJC7M8BGKd7mBCkTeJIm6djibaEfWwWcO80vJi7hwqejrd MtgN/PI8lGls06daUv+gaS+noyk0qYwPccygY8CJkTNs9XgaDyDMf+VckNEGfg1zuenl F+xw== X-Gm-Message-State: ACrzQf0cVEZXfw0ZEL9A75qyGZs0ZPmcQdMOl6PKqsw41B5Xl5NbL400 3vRIhjNQDnGtgEQGWqDokvmPDPB8xQ7Zmw== X-Google-Smtp-Source: AMsMyM72e61Isv3ASb63QLAzd7GvOLG+tEJK6e7CFKXgBs5ZWj9r2NR1UKykIJb3sCI21UgLY3T5MyF00bC9xw== X-Received: from shakeelb.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:262e]) (user=shakeelb job=sendgmr) by 2002:a05:6a00:9a9:b0:541:787f:f2c with SMTP id u41-20020a056a0009a900b00541787f0f2cmr25633816pfg.12.1664222405512; Mon, 26 Sep 2022 13:00:05 -0700 (PDT) Date: Mon, 26 Sep 2022 19:59:31 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog Message-ID: <20220926195931.2497968-1-shakeelb@google.com> Subject: [PATCH] Revert "net: set proper memcg for net_init hooks allocations" From: Shakeel Butt To: 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, Shakeel Butt , Anatoly Pugachev , Vasily Averin , Jakub Kicinski , Linus Torvalds , sparclinux@vger.kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664222406; 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: references:dkim-signature; bh=u8rmArpPmicN7r7IqqfOH58XS1KpMBR85FAb+1BiVJU=; b=urea7bvAyaTLHKxIUCdM2kCY5W4gGIqfqdeDADt7jz2IxCnuNGMvgK8jwE3k8396eHWdkq tqQ7SNl+ssFHeR+3LkOhzF5rcoUHc7aNeJO/TvzirjMr1na6UbtbV5/CYGDeezfkHhOeyN UjUOUS4uSvN5+hTSN9cQfqMCDNDl+S4= ARC-Authentication-Results: i=1; imf31.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=C6QG8W0A; spf=pass (imf31.hostedemail.com: domain of 3xQQyYwgKCLYodWgaahXckkcha.Ykihejqt-iigrWYg.knc@flex--shakeelb.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3xQQyYwgKCLYodWgaahXckkcha.Ykihejqt-iigrWYg.knc@flex--shakeelb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664222406; a=rsa-sha256; cv=none; b=UkQB01cTXYclr6on1RXWkUAeDntufNhNahXi4g6pSnUocfgFZRB+gs4QD2sHdCLkSlqLW1 lWwHKtAaNQSrOcO4zIeceWU0sab41pmpa0eCHRsmP0ufI+P5arYyq7Wlcrqq6XMsAlcFxP bnJ8KWQOPlQonUK+/ZWwOKfAv+iXikY= X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: AFB5D20010 Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=C6QG8W0A; spf=pass (imf31.hostedemail.com: domain of 3xQQyYwgKCLYodWgaahXckkcha.Ykihejqt-iigrWYg.knc@flex--shakeelb.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3xQQyYwgKCLYodWgaahXckkcha.Ykihejqt-iigrWYg.knc@flex--shakeelb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: kbso8guzq4zmxe7j3ug8uiccytohwtgn X-Rspam-User: X-HE-Tag: 1664222406-250556 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: 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. 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 Acked-by: Roman Gushchin Reviewed-by: Muchun Song Acked-by: Johannes Weiner Tested-by: Anatoly Pugachev --- 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);