Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2774212pxb; Mon, 19 Apr 2021 13:39:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDJ9U2BhWO7tkoQ9gi4Icno5+88ImJI5Xne27lD7QXfC1gAQ/6ZkAnq6sKHEEnribUpylP X-Received: by 2002:aa7:d916:: with SMTP id a22mr27686977edr.287.1618864759342; Mon, 19 Apr 2021 13:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618864759; cv=none; d=google.com; s=arc-20160816; b=IDrH+obsRzyvIAZ229XJ0GCZazwBUs2e/oXKB7sR2dap5aybB8mJv2m6iovWl/kjIA BVcsH8e03K/b81inkfN6x0zqkT0rtAQxkPQbTkdqmAATJqtmFPBZLQ2w3l7ZW1c1KkM7 BQS2KNCewQF/OdfYN4BFZg2Ye/oQ0r9ZbIEpU/EJhuoD3UOnswTeQSbmMxB2J5GsR5xd 2hgBySbsW6cMyzKqhW8kx3+w93nxWbcb5uAznckFzA5H0rn2rfXaw63wNfxMZZDW/GIw 7qIcKc2m3CvsGkL8flUpe8xY/k/2459q2phEi5d+QAXeVcvFeGAEuyr7zt3I7txe6LHz eKMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Pte6gDNJh8xhmbfylrLlVHUNlTRi/dJM7p92ChkQdLw=; b=WOYaXzcDANrM+c9UxQSKjmV5WAbw1bMrhIiCAF42EbOa5moVeFm3+s9cMKc/2sC/6H P/L6RxsCV4pYX2dkrzsyaO08BEkS5UTUPILjeqL4lBNQG6QvVteojX6/Zc/vvEET8R5O 8o9kZN7o1DUDsw3fdv1c+WYEFvB0JyTs7OG2rUOKt69PRoWJkICk3ndaRPfd2nVWrt3P FvbLEl+XTvyW+2QXKLTZJAbeAHhpQUEEie/29C/MLzeWGhqN/7deiy8lpfeKvHc7TyXx d8gi+1WoBqYzj/cCYxiytm033UGFY0MbJOPkJIFlbjTv8ZeSXO3I+4dk5dZe4iuJOwA0 fomQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=MwMmN19p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r3si8870043ejs.480.2021.04.19.13.38.55; Mon, 19 Apr 2021 13:39:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=MwMmN19p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239891AbhDSROP (ORCPT + 99 others); Mon, 19 Apr 2021 13:14:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234056AbhDSROO (ORCPT ); Mon, 19 Apr 2021 13:14:14 -0400 Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA284C061761 for ; Mon, 19 Apr 2021 10:13:44 -0700 (PDT) Received: by mail-qk1-x72b.google.com with SMTP id x11so36474539qkp.11 for ; Mon, 19 Apr 2021 10:13:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=Pte6gDNJh8xhmbfylrLlVHUNlTRi/dJM7p92ChkQdLw=; b=MwMmN19pYgiiPxO22E5Bn0qD6lq60MgWWDGEz0TubxyILZCMzhCPfXDVCVEDSTtYDg 1nfmtoD4j9390fHkbbIVqjJxO8le3005eLFTk4YOGXlpwcUu8NeucgF56hni/Z4/4H96 hjZPsaC4TB/U1cY+mFAGTYw9VUOfWgIzXBlndKEF1cuIJIKuz+BNR3QbWRJj+VR1vjrQ LBm94K2doToMiYJK/LvFAcquSUTPiiWtGJno+re8gnauJslto4r/DCHPKPLMt9DNYGfy kOK08NDrLO1kA3L9zeTWIADkRO9VM9Vr32AIuNWKbeIvtecS9RTcBNSfmIcMR3ngEUAx F19w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=Pte6gDNJh8xhmbfylrLlVHUNlTRi/dJM7p92ChkQdLw=; b=karFZJIE6UPm/gNMpsoEA9s0b6rGjvg8XkmuJya2JXIoELNWHahEFaoGQ6kTGS9QQQ d2b+TsIVEn9qlABOFlip6BhTyxjxC0HMpef0yCkkAKVMy2vXcIKVzCP1Y9QsPF+T85o3 ltpZ1CURrM7uuxce75iATpcL4CykJ90gtnljJMOVov/jT3hdWNdK5qthF7VHQG2+UARu +e86gDWYeOejrOpxYLKoD1716NEHxnzo1W0Z0vlZIvXo3JOuN6Dy9NsU2z8VpqgPoLwz C+jHilHCxOgnAwcJ5eoOX9mxX1pAHGmRZHVg7y65CG0uSlbS/6cCz7sInog+nwtDxctR WMXg== X-Gm-Message-State: AOAM533RTSD3pS/1JbPvbWT3bEGbcTnOebITSxldCLAazu5Jkbwrixgy yMBLIqESV2u09dNVTJrpolgSdg== X-Received: by 2002:a37:8bc5:: with SMTP id n188mr12448087qkd.441.1618852423846; Mon, 19 Apr 2021 10:13:43 -0700 (PDT) Received: from localhost (70.44.39.90.res-cmts.bus.ptd.net. [70.44.39.90]) by smtp.gmail.com with ESMTPSA id i23sm123882qtp.61.2021.04.19.10.13.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 10:13:43 -0700 (PDT) Date: Mon, 19 Apr 2021 13:13:42 -0400 From: Johannes Weiner To: Waiman Long Cc: Michal Hocko , Vladimir Davydov , Andrew Morton , Tejun Heo , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Roman Gushchin , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Shakeel Butt , Muchun Song , Alex Shi , Chris Down , Yafang Shao , Wei Yang , Masayoshi Mizuma , Xing Zhengjun , Matthew Wilcox Subject: Re: [PATCH v4 1/5] mm/memcg: Move mod_objcg_state() to memcontrol.c Message-ID: References: <20210419000032.5432-1-longman@redhat.com> <20210419000032.5432-2-longman@redhat.com> <140444ea-14e7-b305-910f-f23fafe45488@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <140444ea-14e7-b305-910f-f23fafe45488@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 19, 2021 at 12:18:29PM -0400, Waiman Long wrote: > On 4/19/21 11:21 AM, Waiman Long wrote: > > On 4/19/21 11:14 AM, Johannes Weiner wrote: > > > On Sun, Apr 18, 2021 at 08:00:28PM -0400, Waiman Long wrote: > > > > The mod_objcg_state() function is moved from mm/slab.h to > > > > mm/memcontrol.c > > > > so that further optimization can be done to it in later patches without > > > > exposing unnecessary details to other mm components. > > > > > > > > Signed-off-by: Waiman Long > > > > --- > > > > ? mm/memcontrol.c | 13 +++++++++++++ > > > > ? mm/slab.h?????? | 16 ++-------------- > > > > ? 2 files changed, 15 insertions(+), 14 deletions(-) > > > > > > > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > > > index e064ac0d850a..dc9032f28f2e 100644 > > > > --- a/mm/memcontrol.c > > > > +++ b/mm/memcontrol.c > > > > @@ -3150,6 +3150,19 @@ void __memcg_kmem_uncharge_page(struct > > > > page *page, int order) > > > > ????? css_put(&memcg->css); > > > > ? } > > > > ? +void mod_objcg_state(struct obj_cgroup *objcg, struct > > > > pglist_data *pgdat, > > > > +???????????? enum node_stat_item idx, int nr) > > > > +{ > > > > +??? struct mem_cgroup *memcg; > > > > +??? struct lruvec *lruvec = NULL; > > > > + > > > > +??? rcu_read_lock(); > > > > +??? memcg = obj_cgroup_memcg(objcg); > > > > +??? lruvec = mem_cgroup_lruvec(memcg, pgdat); > > > > +??? mod_memcg_lruvec_state(lruvec, idx, nr); > > > > +??? rcu_read_unlock(); > > > > +} > > > It would be more naturally placed next to the others, e.g. below > > > __mod_lruvec_kmem_state(). > > > > > > But no deal breaker if there isn't another revision. > > > > > > Acked-by: Johannes Weiner > > > > > Yes, there will be another revision by rebasing patch series on the > > linux-next. I will move the function then. > > OK, it turns out that mod_objcg_state() is only defined if > CONFIG_MEMCG_KMEM. That was why I put it in the CONFIG_MEMCG_KMEM block with > the other obj_stock functions. I think I will keep it there. The CONFIG_MEMCG_KMEM has become sort of useless now. It used to be configurable, but now it just means CONFIG_MEMCG && !CONFIG_SLOB. And even that doesn't make sense because while slob doesn't support slab object tracking, we can still do all the other stuff we do under KMEM. I have a patch in the works to remove the symbol and ifdefs. With that in mind, it's better to group the functions based on what they do rather than based on CONFIG_MEMCG_KMEM. It's easier to just remove another ifdef later than it is to reorder the functions.