Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2356496rwd; Sun, 28 May 2023 13:53:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6fRoa+NMM9d8N3f1uswFqIY/57KAmea0vAnV0sp/E/8G2hv5hUdXoKP0g+Prl3BQxi6PiY X-Received: by 2002:a17:902:e752:b0:1b0:3d54:3564 with SMTP id p18-20020a170902e75200b001b03d543564mr1504504plf.47.1685307224647; Sun, 28 May 2023 13:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685307224; cv=none; d=google.com; s=arc-20160816; b=uxmrl45EaA/GFIwVl0bqbAgw0xzGFfGfpGy/7G6EH99lHOEX1GMM/SZjyIlQnQ17lp XCOiTZhCbV1LKSWj0nS912wdY7oOd8nx7QMMpb9B2aeyHhY1qYLTtsWZuXMs5fX65nR5 P91l+oRu8mgUMrvjMQ35AzcUIaqJgfsYtgbsVvRHo8rdGqcXROIxW6ULz+MPV+yJKfk/ 0oPSLR8bVea6CAl/pJP9FvSDjFwsaM5nl5cowr48K7Ez6eVgkjdJIaYsBn5+5PU7vSFT wcvmQZG1p/JhidetAqvLVO+IaShRTLFUeStF1OsrwOdtopdD78VyMAhPUTWxO1zkPgd4 maMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=t5tzlCcTXM+eOURUdO0t9TVW2oV4Aa+HB1hfHnMu9k8=; b=NGMbhHVtx6maxkrsi/PoPkmte28iYbnxIKBxL3jtu7FMyURJ7SWg4dEJrIqeLOD0MC 8VctgU9NLk8lf+wKbSiq0yv872VYEkoukaWtT24YiGGa69Hg3oxzmiM4QZeOb9FZNfto BV0xrpt24A+k3NAOFQSJ8WjtRpaq+hCsy+0/jkknTO5eJTZkZdHLmPldPhks7GKAgeE3 GOoxE+mP8tP/ZkjoESN6C+u/lmk2KPh5kOeQOtn9dWUsstLTYmhH1qcE9xSrhrpvOe9d PA82hCntF5zLMb9MKxVQPSu0MhEzz4RtkHGZG7TBAlgOZGn7nAvBoo7evJ6j8dGEAq8D xNyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=s8FB2ezd; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x1-20020a170902820100b001ab2aa12e71si7876911pln.346.2023.05.28.13.53.16; Sun, 28 May 2023 13:53:44 -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=@google.com header.s=20221208 header.b=s8FB2ezd; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230170AbjE1UUL (ORCPT + 99 others); Sun, 28 May 2023 16:20:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229621AbjE1UUK (ORCPT ); Sun, 28 May 2023 16:20:10 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 704C8AF for ; Sun, 28 May 2023 13:20:08 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-96fab30d1e1so561679366b.0 for ; Sun, 28 May 2023 13:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685305207; x=1687897207; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=t5tzlCcTXM+eOURUdO0t9TVW2oV4Aa+HB1hfHnMu9k8=; b=s8FB2ezdO7kdcK7pl7RNe0BNVFxC0Yq4k84nMFs4rF20IctkBmf1Yacsu1VPAnMCzR Y4M22U2y5fIznXfBvrbFuDZKtV5znftQpZuw0asdirs89nocYzyo0eo2sw1GSos80sD7 s05H+tuXmiKCtYXhPWMWLJFDqwEuirbWGr3KG3TbrPdYtqek1/pPjFRIpxZG88jMsdNv q3Cpv+9y71x5WDq1kHOuoh/Rqv6Yt7Hran5AsHNMgomVRHT2A3E2IT5c/cFPtiJDrq71 GveYnre8KOKaVbEdTArMu40p+/B89f9Ot573qWvgmJ2YGHnZcDoBRcve5ZCv89kHNU7U OxnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685305207; x=1687897207; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t5tzlCcTXM+eOURUdO0t9TVW2oV4Aa+HB1hfHnMu9k8=; b=U+9TDokVC9E/BSqG+gRV3riOlmrmsK0DqbJR5TuiC9Oo/hz1gvL7OELHyQB1MMYiM4 BsQE0h5xKB0AFUsQLYADYp/2zr64GACkyzt/vvnVCWmc4Ry5Th/RXiRcFSrGeWg5BdLn CPLdoWPI9oKOeLDCkKsj585a5PmdUE4la4xD5D9nPNNCmhzpdCyjBo622TbNkGuVDtqq Dezg/6cNcTN4HJ8nQr6sPbXEX0dYADleICgfLo9fG4Q6lS/pd+hnvs7aPbxiXO46WLpr f1Ul3VLTHtBZta8E8htr8003MmQAPnboA3eLxBnYfn85UynbuZdZ4xfeF8AReAC4VvG2 vnbw== X-Gm-Message-State: AC+VfDy8KOJhp94GpVL9nyvK3uvfqpxdgO10kPn0A+ClAvo3TstXhOd9 5lFvPy73tL2U5rBCRhOXg0RaJnfsN+/+JNJpBd11kw== X-Received: by 2002:a17:907:6d12:b0:95f:969e:dc5a with SMTP id sa18-20020a1709076d1200b0095f969edc5amr4825779ejc.30.1685305206691; Sun, 28 May 2023 13:20:06 -0700 (PDT) MIME-Version: 1.0 References: <20230527103126.398267-1-linmiaohe@huawei.com> In-Reply-To: From: Yosry Ahmed Date: Sun, 28 May 2023 13:19:30 -0700 Message-ID: Subject: Re: [PATCH] memcg: remove unused mem_cgroup_from_obj() To: Muchun Song Cc: Matthew Wilcox , Miaohe Lin , Vasily Averin , hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com, akpm@linux-foundation.org, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Sun, May 28, 2023 at 6:02=E2=80=AFAM Muchun Song = wrote: > > > > > On May 28, 2023, at 02:54, Yosry Ahmed wrote: > > > > On Sat, May 27, 2023 at 8:07=E2=80=AFAM Matthew Wilcox wrote: > >> > >> On Fri, May 26, 2023 at 09:13:05PM -0700, Yosry Ahmed wrote: > >>> On Fri, May 26, 2023 at 9:01=E2=80=AFPM Matthew Wilcox wrote: > >>>> > >>>> On Sat, May 27, 2023 at 06:31:26PM +0800, Miaohe Lin wrote: > >>>>> The function mem_cgroup_from_obj() is not used anymore. Remove it a= nd > >>>>> clean up relevant comments. > >>>> > >>>> You should have looked at the git history to see why it was created > >>>> and who used it. > >>>> > >>>> Shakeel, Vasily, are you going to retry adding commit 1d0403d20f6c? > >>> > >>> That commit did not introduce the function though, no? It was > >>> introduced before it and replaced by other variants over time (like > >>> mem_cgroup_from_slab_obj()). It looks like that commit was reverted ~= 9 > >>> months ago. We can always bring it back if/when needed. > >> > >> The commit immediately preceding it is fc4db90fe71e. > >> > >> Of course we can bring it back. It's just code. But avoiding > >> unnecessary churn is also good. Let's wait to hear from Vasily. > >> > >>> It also looks to me that 1d0403d20f6c was using mem_cgroup_from_obj() > >>> on a struct net object, which is allocated in net_alloc() from a slab > >>> cache, so mem_cgroup_from_slab_obj() should be sufficient, no? > >> > >> Clearly not. > > > > I dived deeper into the history on LKML, and you are right: > > https://lore.kernel.org/all/Yp4F6n2Ie32re7Ed@qian/ > > > > I still do not understand why mem_cgroup_from_slab_obj() would not be > > sufficient, so I am hoping Vasily or Shakeel can help me understand > > here. Seems to be something arch-specific. > > I think it is because *init_net* which is not allocated from slab meant > its address does not belong to linear mapping addresses on arm64. However= , > virt_to_page() is only applicable to linear mapping addresses. So, > mem_cgroup_from_slab_obj() is not sufficient. mem_cgroup_from_obj() is us= ed > in this case, which will use vmalloc_to_page() for the page associated > with *init_net*. If Vasily does not want to bring commit 1d0403d20f6c bac= k, > this patch LGTM. Otherwise, let's wait for Vasily. I see, thanks for the context, Muchun! > > Thanks. >