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 37621C4727D for ; Thu, 24 Sep 2020 07:06:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AFF49235F7 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" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AFF49235F7 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 1A0E890000A; Thu, 24 Sep 2020 03:06:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 15211900004; Thu, 24 Sep 2020 03:06:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0901590000A; Thu, 24 Sep 2020 03:06:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0039.hostedemail.com [216.40.44.39]) by kanga.kvack.org (Postfix) with ESMTP id E804E900004 for ; Thu, 24 Sep 2020 03:06:16 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A9D2E8249980 for ; Thu, 24 Sep 2020 07:06:16 +0000 (UTC) X-FDA: 77297071152.17.bread03_12035662715d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 7AD27180D0181 for ; Thu, 24 Sep 2020 07:06:16 +0000 (UTC) X-HE-Tag: bread03_12035662715d X-Filterd-Recvd-Size: 4079 Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Thu, 24 Sep 2020 07:06:15 +0000 (UTC) Received: by mail-lf1-f66.google.com with SMTP id y11so2699495lfl.5 for ; Thu, 24 Sep 2020 00:06:15 -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=sMDENhoVzpiGX6v9OcAstvvo1HUL1Nmifv0iEhZqDVN6jsBDNdItDNsXtuup2cogNl wmkE8c100BQCqf0jZ6Y1C2MNNJGrP98ZCpnrP12r/FpCS2M1BBRv/lAU47BP00iUaJCR gMlsVM34GxBceyDyfiN/BqHZ6xkanFtsc9KDrpg8JtL220pePcbR6cCDnLaHN/5Ycwg9 lZBFTuLlvJZX8BT/6AdyNpCdfVlzxURDI+MsGly91gsc1gJsnos7tkksi7wfRRaQxtlZ BdZD4rqzKcweAdFDVhCeZOKatHiH3RCwNApGbWrR/v6DEwGwvgpVNn6sUT94IFfvzpud 6qSQ== X-Gm-Message-State: AOAM5310kxCE4LGhvDnzePPd7Y8wUWskV/rrnkx4TJXZ8pnQm6Zhot9m M3DHloj8OR+wpc0bzs9rGa0Kz1Vt+eC/8vN8LmQVHA== 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" 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 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