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 2D0D3C4346E for ; Thu, 24 Sep 2020 07:06:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF16C2388A for ; Thu, 24 Sep 2020 07:06:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kH0LayK5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727133AbgIXHGQ (ORCPT ); Thu, 24 Sep 2020 03:06:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726902AbgIXHGQ (ORCPT ); Thu, 24 Sep 2020 03:06:16 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24FA6C0613CE for ; Thu, 24 Sep 2020 00:06:16 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id w11so2724847lfn.2 for ; Thu, 24 Sep 2020 00:06:16 -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=mMFKn7petaqw14RFBic1L+pEOZugLfwojCWzUGGlGRk=; b=kH0LayK5JtiQ8tepUjGq57EtzET3XZ6P8Txuyf9x/cC+4xEgn59xevZUVDig78jBv3 oeO56q22fL/g1Gwr7UAoFwGY+CTNPf/d6FXFi0AVfJWsRon9MNchf144xgPN88ZoBOEr 6E5MMPJhzLAe/WVbdET9TGizCE864EdeoRwoWW/etbAJe07xxXtsi/HOxxf6A1ca/KSX FNWp23EV+SvkjwXezkwYpzd5soSAqVjIPHNl43t3x1pfUDXQTx+yoYvF7MmfwwfEtN/d 5mpC39PLvwv+oSnmHSm07c61UhWmML33a2VmIzAbQg0jRG3d4cVYu4G73Sjxcj09QPXa sOUA== 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=mMFKn7petaqw14RFBic1L+pEOZugLfwojCWzUGGlGRk=; b=TIwGGXHKpgFT4npXMfaxDx4y54hnLZ+XxrQr/vmo4nfcmVIni27Fzw3BM1JwoJNLVS xQD/CIAznSgpWNLuxE/r9omMStkpy+y/H58mr+ZGkNhTU/CO8vPLCDrVR1xTMf0rxoJN 0yjwVBNbSpoPSQfarA1FMMLLEnX2dk4gu5PFQ7FdBSwsP2ZSZ6/xnY4Qz11YYhVMc6yo OWuuNWRm/fIUwWuDNEThvLH00M58HbgFUtDLzDDxYY/TA4lU0iPYRtUy3qxEfalSSu1P 4EfHXI3UTq1IiBVyekX2JrpYETB71Aqwc5IpU29qQAI5+kopGgGhMatEgm3hwFr9avc1 aZpQ== X-Gm-Message-State: AOAM533aMYxaJXhkdiSA9C74c2LJrHGtAMbcqfJ6Qj5+vHqlkpqAuiiA r+EQE2oom8OPnvbySfZ7N1C5c4FdVGcr0qdkDJk5mg== X-Google-Smtp-Source: ABdhPJyrP+YkIWkaEI+NWeFL5KWoU3afg5MKHhZoH/V0ZiG8R83YgqOxCDiXW2noqxL4i9nQMQQzDrmvX4NiTGlpmV4= X-Received: by 2002:a19:2346:: with SMTP id j67mr1042414lfj.449.1600931174317; Thu, 24 Sep 2020 00:06:14 -0700 (PDT) MIME-Version: 1.0 References: <20200922203700.2879671-1-guro@fb.com> <20200922203700.2879671-5-guro@fb.com> In-Reply-To: <20200922203700.2879671-5-guro@fb.com> From: Shakeel Butt Date: Thu, 24 Sep 2020 00:06:03 -0700 Message-ID: Subject: Re: [PATCH v1 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 22, 2020 at 1:37 PM 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 SetPageMemcgKmem(). __ClearPageKmemcg() > can be simple deleted because clear_page_mem_cgroup() already > does the job. > > As a bonus, on !CONFIG_MEMCG build the PageMemcgKmem() check will > be compiled out. > > Signed-off-by: Roman Gushchin Reviewed-by: Shakeel Butt