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 B60ECC4727C for ; Wed, 30 Sep 2020 21:08:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EAD3120759 for ; Wed, 30 Sep 2020 21:08:31 +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="ZryS3Vhs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAD3120759 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 4CC3D6B005C; Wed, 30 Sep 2020 17:08:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 47DCE6B0062; Wed, 30 Sep 2020 17:08:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 392F66B0068; Wed, 30 Sep 2020 17:08:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0158.hostedemail.com [216.40.44.158]) by kanga.kvack.org (Postfix) with ESMTP id 22F436B005C for ; Wed, 30 Sep 2020 17:08:31 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id DDCAC12FF for ; Wed, 30 Sep 2020 21:08:30 +0000 (UTC) X-FDA: 77320966380.02.scent92_5a06d2027196 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id C109D100DDFCC for ; Wed, 30 Sep 2020 21:08:30 +0000 (UTC) X-HE-Tag: scent92_5a06d2027196 X-Filterd-Recvd-Size: 4168 Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Wed, 30 Sep 2020 21:08:30 +0000 (UTC) Received: by mail-qv1-f66.google.com with SMTP id q10so1726762qvs.1 for ; Wed, 30 Sep 2020 14:08:29 -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=Z7NVwPN8FRHND4Ps48IR2LCzL7gRCF/0sN8/Bym6zig=; b=ZryS3Vhs/ofsUE6v35rSZRt18BInVxIR7lit/zAiHuB2RI4CW2JpdCHvQDqz5Fj/D0 RM9fkXcPqT8+ae4H5/XrqyXF75V7radXS10OrcFfRB8hFY3/Xk1CRkUmrjRaq8HFrVFi e8KzvURuZ+v5uIJR5bm4WHKCaO5QvV3PKcJZFh3GozMdRRnaCu7VLXBQ9rcHEjunF2Me dvLmiB6pHwrIoOz70OGKiK3Nx35dyoSf1+dhiFiamonFDdYcVQdwoax1NRt8hlO0q2ns a/GIW1kMCv6MSFVwzYDd4ewDwYE8RDwK67at1wrTb2KHvzFaRvoNWaUvCRjahg09AOmW 72TA== 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=Z7NVwPN8FRHND4Ps48IR2LCzL7gRCF/0sN8/Bym6zig=; b=FcruZOPphC8J9Qg1PBG2GFj/ZsidS6OWu8GdQMH/4qeGCoJmD2sh5eC3i4Zj1rIfJO y+2MRMmQZ8dlT8okqI7vja03Es72CvQ2/FARXXPtk5IZ9qZghs+3/xRzRFf0pBSpC9XH 6+IslLtNHO5guYArAHmWfkpVgGw3RagIfvxaGha7wynKv/1rokYjgQzNlO7nm/ylKlfS 6rTBTB1IUxS6w1qyhIb3OFqoOM8i9BrLAfpYbXsujmRUlT8I4kWWvWW6NT/zqhIpES5y 134ap6K5eE2Xjrec8ZE+xQkE2owAZFNodqPUcqAOdgzFzLLCtSKiupdd/1ATUTH+HtIP WoSg== X-Gm-Message-State: AOAM531JGhzQXt1vebXavMy/8bXORQu/GiV//Kk5klqqV4JfoqYxnxPT cuK6j0gCENbnO17U2RwiRt3PCw== X-Google-Smtp-Source: ABdhPJylrxzDw10S8wdwfzc4qRuprS+dQI3GNj3BwxTD2mWlLNUgLp8OAj62OYTcRfIhK+gPi6M/Vg== X-Received: by 2002:a0c:8d84:: with SMTP id t4mr4636011qvb.36.1601500109236; Wed, 30 Sep 2020 14:08:29 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:4e22]) by smtp.gmail.com with ESMTPSA id k5sm3498676qkc.45.2020.09.30.14.08.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 14:08:28 -0700 (PDT) Date: Wed, 30 Sep 2020 17:06:49 -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: <20200930210649.GC469663@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.000000, 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: > @@ -449,6 +455,36 @@ static inline void clear_page_memcg(struct page *page) > page->memcg_data = 0; > } > > +/* > + * PageMemcgKmem - check if the page has MemcgKmem flag set > + * @page: a pointer to the page struct > + * > + * Checks if the page has MemcgKmem flag set. The caller must ensure that > + * the page has an associated memory cgroup. It's not safe to call this function > + * against some types of pages, e.g. slab pages. > + */ > +static inline bool PageMemcgKmem(struct page *page) > +{ > + VM_BUG_ON_PAGE(test_bit(MEMCG_DATA_OBJCGS, &page->memcg_data), page); > + return test_bit(MEMCG_DATA_KMEM, &page->memcg_data); Most other places need the bit mask and have to do ad-hoc shifting, which is verbose and causes awkward line wrapping in various places. There are no atomic accesses here, so there is no need to use the atomic bitop interface here. I feel like I've mentioned this before. Just make the MEMCG_DATA_ items bitfields directly, and do return page->memcg_data & MEMCG_DATA_KMEM here. Thanks