Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp101132pxk; Thu, 24 Sep 2020 00:09:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykVJxs5uTinORRaF/Va0GC4iFW4FqvbjjQvVA5d1yyiMQXXwYmJbUgGZNPNZX7nWV1ZxiG X-Received: by 2002:a50:cc9a:: with SMTP id q26mr3321437edi.64.1600931380703; Thu, 24 Sep 2020 00:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600931380; cv=none; d=google.com; s=arc-20160816; b=VZT2fOPyniEKh6KmhjvjHhFSmI4ht0ejTU7b+aztCvPBlCLb0VgdnrIYCL7/t0bqKx GVwpPE3uGlYvGF8HlxDBcZydmtCpo/x+RdSBYOEjtpBcXo0wllSGgyDcZMPyMcmb7Ipa Va943Hd75Q3/N4JAl6Jbw7dt71X5gzLMYW8R/z53nx+X+g84r6s5Zp4zr+2y/zRGntEq b9cs1P/sZBUskoizSOCa/8TcPN82Dt/M7HhZAxah0kq+gSbZfW75AUBMpu0yme+SgFDQ z3LMckL6wW4i2wHYV7LuxVvXwdFKu0IbUTHvYZFUBpOF04qPYV9AN0qP7xyRn2rhpkQA H60A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=mMFKn7petaqw14RFBic1L+pEOZugLfwojCWzUGGlGRk=; b=JK91ARd4ZcPmBF7HDKEN5UdoZxh4g9OMhjPDj8hqcETe0Yx58of/J/AaP6vjnfx0bW yiykkCuphxSuoA6l8MvbK8VZKjocgfWonay+ShdPFK4A/tSgh4rBh3GelGIH3SWKkSAF +xRG8koh9vvQlOyLMyU4z11wtCDDp84qIPX+g92pPKT9CSoYpbj8koQHDM3/TbLSTj2i 3ms7sWevzYItAbAlsy80Uwwoc8IV0kfaSR4xSMH6eLUHkqm/Ew9Bk4yvVCU/nyXzRQJ/ NbbKYQTEMg6HmsE8U+fFgnInXddGB8JA5SR//Gxx2YldA4jVHFMkds3Pcs6nG8lIMv9e 7BHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kH0LayK5; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si1371903ejd.257.2020.09.24.00.09.17; Thu, 24 Sep 2020 00:09:40 -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=@google.com header.s=20161025 header.b=kH0LayK5; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727115AbgIXHGQ (ORCPT + 99 others); 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-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