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=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL 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 74D3BC46466 for ; Mon, 5 Oct 2020 15:18:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DD22520774 for ; Mon, 5 Oct 2020 15:18:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XbVifhi5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD22520774 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 35F286B0083; Mon, 5 Oct 2020 11:18:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 310FB6B0085; Mon, 5 Oct 2020 11:18:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2011B6B0087; Mon, 5 Oct 2020 11:18:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0182.hostedemail.com [216.40.44.182]) by kanga.kvack.org (Postfix) with ESMTP id E2A706B0083 for ; Mon, 5 Oct 2020 11:18:24 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7BABE181AE86F for ; Mon, 5 Oct 2020 15:18:24 +0000 (UTC) X-FDA: 77338228128.15.stop52_6012fb8271bf Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 0C9711814B0CA for ; Mon, 5 Oct 2020 15:18:24 +0000 (UTC) X-HE-Tag: stop52_6012fb8271bf X-Filterd-Recvd-Size: 4179 Received: from mail-lf1-f67.google.com (mail-lf1-f67.google.com [209.85.167.67]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Mon, 5 Oct 2020 15:18:23 +0000 (UTC) Received: by mail-lf1-f67.google.com with SMTP id b22so11309412lfs.13 for ; Mon, 05 Oct 2020 08:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2qOcvP6yZYUR1v8WQaMRDniV7F3qJo7CKmCutWFPBtE=; b=XbVifhi5KVtDLxaTqfpq5MyIp82zE/09YCqj199zSX4K3E3rgtsPrGkLWj+Bs0o6yz db1hPZUCo5H5yqAv770q20hBXCJPYLPrV3QMsf7ht+fAzpfzKDUvc2xNGvqVSqoclp7y y3UkwgyjbTPKtqepRDlAW01V+Ke2cToZ5Q1HBTm42vPprRihBVKoy2b4M81lfPmHMs36 ckVV81sMB+fXThXo97NGhu5XWZXpK51ekR0r5H/PeZawxg19IrTqrMsIpq6kjFyCE0nm qk+THTnhEuBhWF/upGBn2gSEx8gw1Rg0OpDgsAA6VlqKoVfJYFuJ3AxEQ4rnQSZj3GiO DToA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2qOcvP6yZYUR1v8WQaMRDniV7F3qJo7CKmCutWFPBtE=; b=OeZ7JqWTiLFXvxuviiEd9naL63RFbDqO2QkZ/ora2LHfUBOp77O9UKsFZImx6+EkLW mgK4zw0D9VXiTRN0vWvYC6JWz7bR28vxjLkNu3JwLhogRqWRP8xo3tOnTvI8/JHGUwA2 br4CxXAEIpqjf5rhdP2B63aAPJfriRYXxd/mcAu9y63/FCokwaadw/ao53B6iHtwQn1C qRtjdGntIg1rKResVplwyd2zsKOcqs1SMKjWijLP2fjlHd1ste8l0GhWOAfG93pmpZw5 KrzSK5sjSmgHqd7Lmif+UN1D84Xtl+W8fu+L3VWS6X4CT6spQ33kqSVN675CjMEkOd5t G6sQ== X-Gm-Message-State: AOAM53099Wwi3yuZSrB29DhFV93la5bqrcNQ17a0DxoYik+WHIl+BQa7 WRfVcIq+gVqp3kV9JpYmPaC/cxl+V2hOKI5ofRM6sg== X-Google-Smtp-Source: ABdhPJxjpGsjngB1hmr5J6waZxkLGXegfaskQxGiD+jsJdfvIziNgRfxZfHW4Vy6mGw+s/EC6i14WRLpKxhQ/FGr1vk= X-Received: by 2002:a19:4084:: with SMTP id n126mr639lfa.54.1601911101455; Mon, 05 Oct 2020 08:18:21 -0700 (PDT) MIME-Version: 1.0 References: <20201002172559.4000748-1-guro@fb.com> <20201002172559.4000748-5-guro@fb.com> In-Reply-To: <20201002172559.4000748-5-guro@fb.com> From: Shakeel Butt Date: Mon, 5 Oct 2020 08:18:10 -0700 Message-ID: Subject: Re: [PATCH v5 4/4] mm: convert page kmemcg type to a page memcg flag To: Roman Gushchin Cc: Andrew Morton , Johannes Weiner , Michal Hocko , LKML , Linux MM , Kernel Team Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Oct 2, 2020 at 10:26 AM Roman Gushchin wrote: > > PageKmemcg flag is currently defined as a page type (like buddy, > offline, table and guard). Semantically it means that the page > was accounted as a kernel memory by the page allocator and has > to be uncharged on the release. > > As a side effect of defining the flag as a page type, the accounted > page can't be mapped to userspace (look at page_has_type() and > comments above). In particular, this blocks the accounting of > vmalloc-backed memory used by some bpf maps, because these maps > do map the memory to userspace. > > One option is to fix it by complicating the access to page->mapcount, > which provides some free bits for page->page_type. > > But it's way better to move this flag into page->memcg_data flags. > Indeed, the flag makes no sense without enabled memory cgroups > and memory cgroup pointer set in particular. > > This commit replaces PageKmemcg() and __SetPageKmemcg() with > PageMemcgKmem() and an open-coded OR operation setting the memcg > pointer with the MEMCG_DATA_KMEM bit. __ClearPageKmemcg() can be > simple deleted, as the whole memcg_data is zeroed at once. > > As a bonus, on !CONFIG_MEMCG build the PageMemcgKmem() check will > be compiled out. > > Signed-off-by: Roman Gushchin > Acked-by: Johannes Weiner Reviewed-by: Shakeel Butt