Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4920994pxk; Wed, 30 Sep 2020 15:40:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAqcxJNeyyOp/T9H7HwQ6BTHrwMHP6HbjzznHHQbNH2w3xRn+yJ0K52CLv/NrE8I4DNrjp X-Received: by 2002:a50:ee10:: with SMTP id g16mr5494915eds.258.1601505647348; Wed, 30 Sep 2020 15:40:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601505647; cv=none; d=google.com; s=arc-20160816; b=QG2WQKTMZlHPvZw0lCv2PjvmhNY1DGGMQnLfbDRtNt4dFjNVSnbU6AoUZc1FkCVOab fGDoN7cF6Ot5aQJNYAbADD5dKk00nD1V5uyqKs0RV5IPQAHxLZtTOXrTGovJu2e9O3pR dxhFqnUe+iBJPXeF3higeUTf7+adMmb/L8K+/cLlXyzQhY9FgNJ6klfM4ZLvZzDyXYul XTDSznHQGBE8HuJgWvSu1aZI715hDy7Ovf4tlJjcbvqn3X/21qLAnNvEySpgJTpZgR++ OpQDcYgBPGc9ySTTFHSeI2paf36Ca8XliFBNo4r2KxPrxELmI0A6lIJqaSIwr2dU+PPV Qwcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Z7NVwPN8FRHND4Ps48IR2LCzL7gRCF/0sN8/Bym6zig=; b=Kb/zoKMog27yyCAfQcKxuNwk7S0yEAh/qIiw6lWn/rzHoQcb9YTODddYhuSQStqCsl fnr0oLvSmTM8Op0WNG6zkvbqKW3XSsttz+OT38ncxIcuguiM6XyhiDRX0oug7NGV2XrQ TqL/TUH6iRrbWDtgEhUHO+hPPTO8wutnGaew7x1njMDT+i88pBOpY5bVy416OzGZPujL /Vvs5xDmTdHyxVe/4DszC162GtJA6u0gNNGhjK2SgglszG93vgIOoObIUHoZA+EC1XUR nxPNUJHodHymUG8PVf1JhlBkk6N1L154nY2HqTcE44BNALO0v8KM16BanZ7akcQd3pJe 1i8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=ZryS3Vhs; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b29si2243558ejl.385.2020.09.30.15.40.24; Wed, 30 Sep 2020 15:40:47 -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=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=ZryS3Vhs; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730766AbgI3VIa (ORCPT + 99 others); Wed, 30 Sep 2020 17:08:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730090AbgI3VIa (ORCPT ); Wed, 30 Sep 2020 17:08:30 -0400 Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C38AC061755 for ; Wed, 30 Sep 2020 14:08:30 -0700 (PDT) Received: by mail-qv1-xf42.google.com with SMTP id cy2so1732286qvb.0 for ; Wed, 30 Sep 2020 14:08:30 -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=JV8XbPzZyipQgzxUf7XsUG+N+dpZeCXruBVtgUKd0qHRlRW3A4sbgX4jruEhsemHiM K+Kvz5O6vTugTW4ZQd/aqrZ/fFD3CbgzF+ue6lELOBfkR6F4zceL1foYGmWnFd1zgbVc RAvHQXUXdR1snexDcz8QgRsD9MW7qunmQtaknRntTPDlEireMhupY87JoLQJMgpsyn8i G8uhstD1RaYWiopsSwsB/ULspbJqC3ZQgPo6hUOq4oGj3q+0xxYS76H5630BE9SkOz/B twXqIDuz3hKK6Mcg/JTQtmke//A8StmbUCGbv9bq2NZc0T15idb8XxbmxhRTqSbIQIYP nG8A== X-Gm-Message-State: AOAM533Kci/kdMB0QfShRqpwovXu+O6BLkpTIyLKc/zoGfVrwVNEstiP eiPfDvdJDle6vLyJEP63x1cjjQ== 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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