Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp929636pxb; Thu, 15 Apr 2021 09:41:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfwdK08nUOiVWLtEFcpqruDkIUP2mBl4O9jIvpdBq7kEumq04UeKwNjifaRUShIzMcwqru X-Received: by 2002:a05:6402:5146:: with SMTP id n6mr5403681edd.299.1618504891632; Thu, 15 Apr 2021 09:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618504891; cv=none; d=google.com; s=arc-20160816; b=zNHVdYLb6OlQTYSTrugMWw+momiOe5xRETA64BUHHnFgSyMX4Bs4/CbAe2WvNFqC4X jO1R0j3cNkBtm7ISXTij99o9BWqacKzFydTVBfNtDR+hbkVVNH9i49sKcW8jPe3j2stA cICQ9PyR0m8cEYWQBmm9uig8hSkzOkfqkaoyZDMjD2aZhAkFATfK3jMQn89o5y68d1gE NmWyXuq8KBPrvX3uRj9l+nV0DKjyJhoWLVXsEqQ9ucYftbyIeYq0S+/dDiRCXsNgqogq zidqUcGY00EygZ/FIVtG3BvjVcbDUTaBRS2KbthdO3fEI7GW5luPnYLHHi7PxSgeKBHt XOew== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+MTg13jTruCvQFaQ2SQHWrJMRTHVexZhbO2LJXAAyHU=; b=Q1cyqrqs0ywYAK9tytGRNNbQqvapBbVmyq2hUS4CpSIIibxptGJ0SV9sC7BUDd610a tvah8ojtknd6N7UIOAtxgKwQOBq7PN5w6gUhd5xQ8OEy7UZIaDevXhHMYUcjOFscfHmT /kXpGCo9/4WhVeVP+fa1e3D3AvJqdeLTdie74VvkrSA7gOE9N3+ePn4u4ll0Ryv9hpMR SfzMDdrexUa+sYu6I7HjxF9NFBEJ63xbSFDmnS9tb1d0rKvnxqhuTn7rnqVxqEJo02KB 8VOckPaJU+SLI3O9QHauuL7YSfj6TyQVmp9LDGOkYwHHyLbhkp9YFTLrwEz6wnwYCpbY RpRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=f2azcLNZ; 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 q11si2767079edd.16.2021.04.15.09.41.08; Thu, 15 Apr 2021 09:41:31 -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=f2azcLNZ; 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 S231137AbhDOQkg (ORCPT + 99 others); Thu, 15 Apr 2021 12:40:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233330AbhDOQkf (ORCPT ); Thu, 15 Apr 2021 12:40:35 -0400 Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8DF0C061574 for ; Thu, 15 Apr 2021 09:40:11 -0700 (PDT) Received: by mail-qt1-x82f.google.com with SMTP id m16so18001606qtx.9 for ; Thu, 15 Apr 2021 09:40:11 -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:in-reply-to; bh=+MTg13jTruCvQFaQ2SQHWrJMRTHVexZhbO2LJXAAyHU=; b=f2azcLNZKFWVZUi+8XlEbk6xsbqrFPaLUskuzNkt4yE1HRpTTrcLRwV2kQt0HrgDFE rVwpA9q0JEuyse5ePGHghwY1t+A+GPkgJb2OnZjCHD/VJyH3ZKGS46D6pgCtC7Z95JtM 33KKM18EU0EJI9eOZQhPb2U8b3GuVPqpmGv8JwgbzjxbOB/v2c64Uq6WeExA1QmpQZt+ 92/nDRBZIHZ1AUlVayRBlQ7+vA8kHBZynbnsZ/kVg2GY43428DBGz9LPK06fYEh6wZBX /I7JO6qcEZx2/Ltz/urm+ZH7FxV3/MALWzsvBgzcEo9pgtbfhLRKOZVHur6XLWVGIzaQ hAgw== 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:in-reply-to; bh=+MTg13jTruCvQFaQ2SQHWrJMRTHVexZhbO2LJXAAyHU=; b=USq6RmLlnrBcym3GYSWuQq5E1mWEDyt0Aw8HEp9nRdqsyqGUcNRe0yxl8GRYGG5zzC noE4rp6unguof1x0oCTTM1Lkyfi5bzoIFDD3Xfda5lHIJsaQtHNxvRtMmTGRsE37jhLd sOzMFdfo40b4wBPrbQFiGANZaWP4DNKpdb1fliMk1Me4ECmiIhv290MyDW2NfrWiF6jP eloESIz3PmOf5Xd06Z17P7aMRjFt0tBEO0nlS91uUYZLcZMDVRToxmr+lRzGn1X8DL6G Ff9yND8L1AYCJkhk5wP3Bb+eXitTdGmJ9rjmE3PJ7SMr5+HPKiQ/zhzPrfaRoFXfIPv5 7qRA== X-Gm-Message-State: AOAM531rjMpuM2QAeF4AIRkkc0hxyXoeynjilMqLdRRekH8JlG1sgt/a NAjCLxWCYanvNqRZOdA/aKATfQ== X-Received: by 2002:ac8:57cf:: with SMTP id w15mr3899983qta.336.1618504811194; Thu, 15 Apr 2021 09:40:11 -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 m11sm2173946qtg.67.2021.04.15.09.40.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Apr 2021 09:40:10 -0700 (PDT) Date: Thu, 15 Apr 2021 12:40:10 -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 Subject: Re: [PATCH v3 1/5] mm/memcg: Pass both memcg and lruvec to mod_memcg_lruvec_state() Message-ID: References: <20210414012027.5352-1-longman@redhat.com> <20210414012027.5352-2-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210414012027.5352-2-longman@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 13, 2021 at 09:20:23PM -0400, Waiman Long wrote: > The caller of mod_memcg_lruvec_state() has both memcg and lruvec readily > available. So both of them are now passed to mod_memcg_lruvec_state() > and __mod_memcg_lruvec_state(). The __mod_memcg_lruvec_state() is > updated to allow either of the two parameters to be set to null. This > makes mod_memcg_lruvec_state() equivalent to mod_memcg_state() if lruvec > is null. > > The new __mod_memcg_lruvec_state() function will be used in the next > patch as a replacement of mod_memcg_state() in mm/percpu.c for the > consolidation of the memory uncharge and vmstat update functions in > the kmem_cache_free() path. This requires users who want both to pass a pgdat that can be derived from the lruvec. This is error prone, and we just acked a patch that removes this very thing from mem_cgroup_page_lruvec(). With the suggestion for patch 2, this shouldn't be necessary anymore, though. And sort of underlines my point around that combined function creating akwward code above and below it.