Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A493C433EF for ; Tue, 14 Dec 2021 13:51:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234560AbhLNNvA (ORCPT ); Tue, 14 Dec 2021 08:51:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230146AbhLNNu4 (ORCPT ); Tue, 14 Dec 2021 08:50:56 -0500 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AD66C061748 for ; Tue, 14 Dec 2021 05:50:56 -0800 (PST) Received: by mail-qv1-xf2f.google.com with SMTP id bu11so17320452qvb.0 for ; Tue, 14 Dec 2021 05:50:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Rx+hqR5BLDytRmc1k+qRylCXkJ+6AQ7elY7tUqHK8RA=; b=SAn4jhcDHzoZJgY6lNfz1wDtjhMMGbgWvc0lPp7zZX7SuNOLZF+4qB4Ky040g04jVZ xzMHRnnCINKQEcs6YvsOWKPpXyj9FidivDBbfCEzj/PbELvdznhM0sKgL4YmEZJlIo+n KUmcaQT76EqQI5jsUrshYIfS28FPn4nvLmbOOjACQ5tLrpXYwpVnsv8tC6M4gJXFrrXj 4GHfTbdKjqLNERoy9OCH0WdYGV+IrpdndDDYITNl57sFm+XGTuVTi0jOIy2CUNoTjzXu Gbs1xM2qzeapIYvRFeiedU155eAv2wfclcaONKwzBjxndW3piEWPi2Mlr/c7IAarZUhC nRoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Rx+hqR5BLDytRmc1k+qRylCXkJ+6AQ7elY7tUqHK8RA=; b=Cfypn05szHOnix2mE4NtSIzR/wEmyTTvbwI6UOvyw5XgStHG+67q2yp26BXrBcuVYT GTfs0SLa67pLtl/NWTnREdcb1VoxISqtJFFDaMzCfXdZnKPHXK0P39WL3/+ph3alrBqi as6tE2GML7NE13xqlztrdfZ9V+X5Uwfvxpg0A8EjtdEhog0/kqk2Y59vH5Lkv9eV1bxp s+dwEvxMmCfY/2aPD3qhTwcSXKigk7mZRFOVzWaz1bReUVJ/TzcTZtxiGcfAaA4pkqML xyjGpc4iWpGQAygx8VQW/SzWT+XbzywSNzjiLmCMiFRqa5M8vCIcIyCFTQ9/4BLmd2Cn kZgA== X-Gm-Message-State: AOAM533sI9fLoQENwTOVEil+g+lTKe7NItxYr0xcyCAgSgK+jf5fiB2t kK4CHIOyKDRYi5d7h8rBIWnjqQ== X-Google-Smtp-Source: ABdhPJyY3iPu7+f980O6CZq77edRBaM323uDa1Fe74X6ayyglYZzYoBacLC4AtJ5fzzQ6Ldvs3bcXQ== X-Received: by 2002:a05:6214:1631:: with SMTP id e17mr5489515qvw.58.1639489855166; Tue, 14 Dec 2021 05:50:55 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:e1e4]) by smtp.gmail.com with ESMTPSA id y15sm7671961qko.74.2021.12.14.05.50.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 05:50:53 -0800 (PST) Date: Tue, 14 Dec 2021 14:50:48 +0100 From: Johannes Weiner To: Muchun Song Cc: willy@infradead.org, akpm@linux-foundation.org, mhocko@kernel.org, vdavydov.dev@gmail.com, shakeelb@google.com, guro@fb.com, shy828301@gmail.com, alexs@kernel.org, richard.weiyang@gmail.com, david@fromorbit.com, trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, jaegeuk@kernel.org, chao@kernel.org, kari.argillander@gmail.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, zhengqi.arch@bytedance.com, duanxiongchun@bytedance.com, fam.zheng@bytedance.com, smuchun@gmail.com Subject: Re: [PATCH v4 02/17] mm: introduce kmem_cache_alloc_lru Message-ID: References: <20211213165342.74704-1-songmuchun@bytedance.com> <20211213165342.74704-3-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211213165342.74704-3-songmuchun@bytedance.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 14, 2021 at 12:53:27AM +0800, Muchun Song wrote: > +/* > + * The allocated list lru pointers array is not accounted directly. > + * Moreover, it should not come from DMA buffer and is not readily > + * reclaimable. So those GFP bits should be masked off. > + */ > +#define LRUS_CLEAR_MASK (__GFP_DMA | __GFP_RECLAIMABLE | __GFP_ACCOUNT | __GFP_ZERO) There is already GFP_RECLAIM_MASK for this purpose, you can use that. > +int memcg_list_lru_alloc(struct mem_cgroup *memcg, struct list_lru *lru, > + gfp_t gfp) > +{ > + int i; > + unsigned long flags; > + struct list_lru_memcg *mlrus; > + struct list_lru_memcg_table { > + struct list_lru_per_memcg *mlru; > + struct mem_cgroup *memcg; > + } *table; > + > + if (!list_lru_memcg_aware(lru) || memcg_list_lru_allocated(memcg, lru)) > + return 0; > + > + gfp &= ~LRUS_CLEAR_MASK; gfp &= GFP_RECLAIM_MASK;