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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79361C433FE for ; Sun, 1 May 2022 21:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355009AbiEAVN1 (ORCPT ); Sun, 1 May 2022 17:13:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354953AbiEAVN0 (ORCPT ); Sun, 1 May 2022 17:13:26 -0400 Received: from out0.migadu.com (out0.migadu.com [IPv6:2001:41d0:2:267::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02D30FD34; Sun, 1 May 2022 14:09:59 -0700 (PDT) Content-Type: text/plain; charset=utf-8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1651439396; h=from:from: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; bh=WKDIQf5YU17uxh4rrGWr9X3eU/7EjCb3dKHQ+RI13NM=; b=ErAYkoy8SGeqig6yJdiYyw7Ot9Lryj1rEO8aAlGEhY/qHTXfpBSqY8LsRp7fqFiv6FkmER wff03KP5AxxltMOkRtZmEz9t9u7gmdBgFvOhjJ0ubJH80rA3q3H6f6bAfURXExHlsRS3vz CEA3rbbu0cJncAwfrI4SHmiUjFU5DQ0= Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [PATCH memcg v4] net: set proper memcg for net_init hooks allocations X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin In-Reply-To: <78b556f9-e57b-325d-89ce-7a482ef4ea21@openvz.org> Date: Sun, 1 May 2022 14:09:49 -0700 Cc: Shakeel Butt , =?utf-8?Q?Michal_Koutn=C3=BD?= , Vlastimil Babka , kernel@openvz.org, Florian Westphal , LKML , Michal Hocko , Cgroups , netdev , "David S. Miller" , Jakub Kicinski , Paolo Abeni Message-Id: <092476D2-C2C4-496C-A92C-EC0B331990ED@linux.dev> References: <78b556f9-e57b-325d-89ce-7a482ef4ea21@openvz.org> To: Vasily Averin X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > On May 1, 2022, at 6:44 AM, Vasily Averin wrote: >=20 > =EF=BB=BFOn 4/28/22 01:47, Shakeel Butt wrote: >>> On Wed, Apr 27, 2022 at 3:43 PM Vasily Averin wrote: >>>=20 >>> On 4/27/22 18:06, Shakeel Butt wrote: >>>> On Wed, Apr 27, 2022 at 5:22 AM Michal Koutn=C3=BD w= rote: >>>>>=20 >>>>> On Tue, Apr 26, 2022 at 10:23:32PM -0700, Shakeel Butt wrote: >>>>>> [...] >>>>>>>=20 >>>>>>> +static inline struct mem_cgroup *get_mem_cgroup_from_obj(void *p) >>>>>>> +{ >>>>>>> + struct mem_cgroup *memcg; >>>>>>> + >>>>>>=20 >>>>>> 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=3Dnokmem" boot >>>>>> param. >>>=20 >>> Shakeel, unfortunately I'm not ready to answer this question right now. >>> I even did not noticed that memcg_kmem_enabled() and mem_cgroup_disabled= () >>> have a different nature. >>> If you have no objections I'm going to keep this place as is and investi= gate >>> this question later. >>>=20 >>=20 >> Patch is good as is. Just add the documentation to the functions in >> the next version and you can keep the ACKs. >=20 > I noticed that the kernel already has a function get_mem_cgroup_from_objcg= (), > the name of which is very similar to my new function get_mem_cgroup_from_o= bj(). > Maybe it's better to rename my function to get_mem_cgroup_from_ptr()? I don=E2=80=99t think it=E2=80=99s a problem: objcg is a widely used abbrevi= ation and in my opinion is different enough from obj. I=E2=80=99d keep it fo= r the consistency with the mem_cgroup_from_obj(). Thanks!=