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 X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 368E5C4741F for ; Wed, 30 Sep 2020 21:03:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 83BBB2076B for ; Wed, 30 Sep 2020 21:03:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="ZPMlqzGe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83BBB2076B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A32776B005C; Wed, 30 Sep 2020 17:03:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E3236B0062; Wed, 30 Sep 2020 17:03:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8AA7D6B0068; Wed, 30 Sep 2020 17:03:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0231.hostedemail.com [216.40.44.231]) by kanga.kvack.org (Postfix) with ESMTP id 715486B005C for ; Wed, 30 Sep 2020 17:03:06 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2B8371803817F for ; Wed, 30 Sep 2020 21:03:06 +0000 (UTC) X-FDA: 77320952772.15.grass70_5d03a9227195 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 091F11800E38D for ; Wed, 30 Sep 2020 21:03:06 +0000 (UTC) X-HE-Tag: grass70_5d03a9227195 X-Filterd-Recvd-Size: 4264 Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Wed, 30 Sep 2020 21:03:05 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id o5so2997755qke.12 for ; Wed, 30 Sep 2020 14:03:05 -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=ZRNUEYokhV3ZutF68bV0ggq8sZtd21gQc+Q8hzdPDf0=; b=ZPMlqzGeCEiHwTpGNWQLeLMFfU7QFks6fD3heUFDiL6Fl+RiNeu1Cobjoo+BJcl93S hzMxUPbOGOe08lo/KW6S733CLxTmV8j/zDx4ZrFhZQvhcJ1fkW49L+YZLt1PKE13PyZv syxAZoY7aX0VsFPIhYp8JUj46b2AO7cv+6ELGA1fSWw8e5JeJiJnY0cQ8k6a9yzb6gY7 uvb+pQciV2SKlPiAsWmDawryvdqq8Brn8QblFklUWhH62A+qSu6oa/K7STMbVXrIJbub b1ZyvdPyGax23mJx9drhhJtzR2QXHZ+blG3/wN2QtP6sfAVAyQabpVT+Cd1pTnTfgd7P Zs/g== 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=ZRNUEYokhV3ZutF68bV0ggq8sZtd21gQc+Q8hzdPDf0=; b=V9WP/bqXVX9tYJn6jA+H4FUjLMX30avP+HC4OuT1wvBUdarhDx4BE9mhXRosloO7zH lVchFEz1RqahIV/Bcy0kRc2S/NrLXXtGPz9ABhRInuJNU9hJ4fHkg+GeMmp/d4x84KCj fyBYmPWm7wd9236V+DtJM/B6BJLo70DDoUscUL9nVzxNcnt1L/7fIPfGLbasL1Pryo5S 6MkFZRwf40OmhMn+ygLW/+Mh7u5L4BfLHGwFsz6ccb16lbRknoPU2G8z2N11747NTlPn VuhgGu66axWZVl93oXa+MLhRMQCYPJpp8/YpFTQWVoNX5Islg21tpweAY5SveKZNoEER xUXg== X-Gm-Message-State: AOAM530VmUk4sxiK2OnGt2A2sXPZc9uAcHOVYIdFNHk+J8I9P1zboFBQ NrWedT+CN4QKQF4sDVj3+nrMBA== X-Google-Smtp-Source: ABdhPJweyidEzcAjSdMU/ZGDN0yZ4JtMYv5rz4uyhcVHpfgAjWjXCssDh/lwfcnPQ1yvxD4ac4XsIQ== X-Received: by 2002:a37:d41:: with SMTP id 62mr4375984qkn.444.1601499784348; Wed, 30 Sep 2020 14:03:04 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:4e22]) by smtp.gmail.com with ESMTPSA id 8sm3571982qkc.100.2020.09.30.14.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 14:03:03 -0700 (PDT) Date: Wed, 30 Sep 2020 17:01:24 -0400 From: Johannes Weiner To: Roman Gushchin Cc: Andrew Morton , Shakeel Butt , Michal Hocko , linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-team@fb.com Subject: Re: [PATCH v3 4/4] mm: convert page kmemcg type to a page memcg flag Message-ID: <20200930210124.GB469663@cmpxchg.org> References: <20200929235920.537849-1-guro@fb.com> <20200929235920.537849-5-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200929235920.537849-5-guro@fb.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Sep 29, 2020 at 04:59:20PM -0700, Roman Gushchin wrote: > @@ -3087,7 +3087,7 @@ int __memcg_kmem_charge_page(struct page *page, gfp_t gfp, int order) > ret = __memcg_kmem_charge(memcg, gfp, 1 << order); > if (!ret) { > set_page_memcg(page, memcg); > - __SetPageKmemcg(page); > + __SetPageMemcgKmem(page); > return 0; > } > css_put(&memcg->css); > @@ -3112,10 +3112,6 @@ void __memcg_kmem_uncharge_page(struct page *page, int order) > __memcg_kmem_uncharge(memcg, nr_pages); > clear_page_memcg(page); > css_put(&memcg->css); > - > - /* slab pages do not have PageKmemcg flag set */ > - if (PageKmemcg(page)) > - __ClearPageKmemcg(page); Hm, the named flags are great, and the getter functions are complex enough to justify helpers. But both flags are set along with the object pointer, and cleared when the pointer is cleared (which makes sense, because pages can not change their type while they're alive). page_clear_memcg() and page_clear_objcgs() do the same thing. page->memcg_data = (unsigned long)pointer | MEMCG_DATA_TYPE; and page->memcg_data = 0; are straight-forward and really don't require abstraction. Please open-code these.