Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4523924ioa; Wed, 27 Apr 2022 05:48:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1+D6I46BRqa75zHGpKLuAW+/WJEIYKOHhj8XbEn3cv7uzLZM4nym1rBu78QV4V0ETNDLW X-Received: by 2002:a65:6c0b:0:b0:39d:8c30:4bb9 with SMTP id y11-20020a656c0b000000b0039d8c304bb9mr23537306pgu.411.1651063728116; Wed, 27 Apr 2022 05:48:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651063728; cv=none; d=google.com; s=arc-20160816; b=tN8Au5JcQ63Plrm4KXghVMzqd/6C3G2mzYFk2ug4Edopiw6wwVkVVoPG8Zxm8C/NXy 7rQjGcp/Asi5kn+I9L3CV0BuMOS8GFmrhpwo2wADQ8P6A4I06zbBaPEEEcqiX3OMpKgE zMWiIQCWLrVdSbU9e/c7o/KqL0u4NpNJrEBIpfCq3WB4feSzBR4msNkAIIpYWE7YBUtZ 8fxoybHHBkFj/suP71nwhTJupsgMGFavnpLmExUqgu94cbPGcUNAfoOLBzqDPI3QWA43 FIhfwj//5mvhmT9b2K6xq/buqGSRUbQDL5c2nhPB/51mhTJtFUUBBJNg7Okyh/c7j7Ht WrpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=bPJVJ/mvoFlMUFOZPBJ+knXZSOjq1aUlwWwkq9LhQTo=; b=OwZwikM4JPBvqdSt7eB0AGmWqbNDRExDVfuuPDmttNm2BR1W7kOTDs2urcr8eNikpI 7LJFzEb389VrX8P9/WFPLFyFp7H9h/iqAHNiolnX/WmkphP+MMrMaCu7wpgaFxofSIUD vCWhW0MdozFGOXvGIGVN6tz4+89QKE/ERyzl0trQqPhBKoueD+FJ6gx7k3fpBPeM1pKW cQNp5NPToo1aUe8wZe1ZPHB0vEWzUoXRQQHiNP4+XTESDw9AQhSG++c0bnZ0wJk1fAZD R5NoRU/EHhUZbrPgghBsn7Xpkp18SMbc520dflIys9HhQzJF8lyAYwIT3afvZQJQur3S Z+1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=n6Zsmd3Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z1-20020aa78881000000b0050aa4c2957dsi485217pfe.131.2022.04.27.05.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 05:48:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=n6Zsmd3Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C555B49F81; Wed, 27 Apr 2022 05:22:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234113AbiD0MZw (ORCPT + 99 others); Wed, 27 Apr 2022 08:25:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233930AbiD0MZr (ORCPT ); Wed, 27 Apr 2022 08:25:47 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9146C4132E; Wed, 27 Apr 2022 05:22:35 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1B9681F74B; Wed, 27 Apr 2022 12:22:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1651062154; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bPJVJ/mvoFlMUFOZPBJ+knXZSOjq1aUlwWwkq9LhQTo=; b=n6Zsmd3ZvSPkPhiIdXXfFL6ehZn8AL7BshvVE3p+w5JDx9muTQd5wKkGExHgczFgQH8G4e d8rlT0rW81Ve1qiYTkNlC1dukAx4Q4DIDccyG20zh1OfPZXR6eF7ygx84SM0nBfFl5krNz Ihf/Jng1e1v9VeCT1AdFdSHRSN77vjg= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CD64F13A39; Wed, 27 Apr 2022 12:22:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id AT8+MYk1aWLfOAAAMHmgww (envelope-from ); Wed, 27 Apr 2022 12:22:33 +0000 Date: Wed, 27 Apr 2022 14:22:32 +0200 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Shakeel Butt Cc: Vasily Averin , Vlastimil Babka , Roman Gushchin , kernel@openvz.org, Florian Westphal , LKML , Michal Hocko , Cgroups , netdev , "David S. Miller" , Jakub Kicinski , Paolo Abeni Subject: Re: [PATCH memcg v4] net: set proper memcg for net_init hooks allocations Message-ID: <20220427122232.GA9823@blackbody.suse.cz> References: <33085523-a8b9-1bf6-2726-f456f59015ef@openvz.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no 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 Tue, Apr 26, 2022 at 10:23:32PM -0700, Shakeel Butt wrote: > [...] > > > > +static inline struct mem_cgroup *get_mem_cgroup_from_obj(void *p) > > +{ > > + struct mem_cgroup *memcg; > > + > > Do we need memcg_kmem_enabled() check here or maybe > mem_cgroup_from_obj() should be doing memcg_kmem_enabled() instead of > mem_cgroup_disabled() as we can have "cgroup.memory=nokmem" boot > param. I reckon such a guard is on the charge side and readers should treat NULL and root_mem_group equally. Or is there a case when these two are different? (I can see it's different semantics when stored in current->active_memcg (and active_memcg() getter) but for such "outer" callers like here it seems equal.) Regards, Michal