From: Mina Almasry <almasrymina@google.com>
To: Muchun Song <muchun.song@linux.dev>
Cc: Shakeel Butt <shakeelb@google.com>,
Huang Ying <ying.huang@intel.com>,
Yang Shi <yang.shi@linux.alibaba.com>,
Yosry Ahmed <yosryahmed@google.com>,
Tim Chen <tim.c.chen@linux.intel.com>,
weixugc@google.com, gthelen@google.com, fvdl@google.com,
Tejun Heo <tj@kernel.org>, Zefan Li <lizefan.x@bytedance.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Jonathan Corbet <corbet@lwn.net>,
Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Muchun Song <songmuchun@bytedance.com>,
Andrew Morton <akpm@linux-foundation.org>,
cgroups@vger.kernel.org,
Linux Doc Mailing List <linux-doc@vger.kernel.org>,
linux-kernel@vger.kernel.org,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [RFC PATCH v2] mm: Add nodes= arg to memory.reclaim
Date: Thu, 1 Dec 2022 22:24:14 -0800 [thread overview]
Message-ID: <CAHS8izPCh+=iUMVP4Xa7FLXc=xtWc7VkLSpk2gugL=f0koBb=Q@mail.gmail.com> (raw)
In-Reply-To: <F2917C72-A6F4-4969-B044-211F0D3856F1@linux.dev>
On Thu, Dec 1, 2022 at 10:05 PM Muchun Song <muchun.song@linux.dev> wrote:
>
>
>
> > On Dec 2, 2022, at 06:10, Mina Almasry <almasrymina@google.com> wrote:
> >
> > On Thu, Dec 1, 2022 at 1:32 PM Shakeel Butt <shakeelb@google.com> wrote:
> >>
> >> On Tue, Nov 29, 2022 at 06:03:27PM -0800, Mina Almasry wrote:
> >> [...]
> >>> diff --git a/mm/vmscan.c b/mm/vmscan.c
> >>> index 7b8e8e43806b..23fc5b523764 100644
> >>> --- a/mm/vmscan.c
> >>> +++ b/mm/vmscan.c
> >>> @@ -6735,7 +6735,8 @@ unsigned long mem_cgroup_shrink_node(struct mem_cgroup *memcg,
> >>> unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
> >>> unsigned long nr_pages,
> >>> gfp_t gfp_mask,
> >>> - unsigned int reclaim_options)
> >>> + unsigned int reclaim_options,
> >>> + nodemask_t nodemask)
> >>
> >> Can you please make this parameter a nodemask_t* and pass NULL instead
> >> of NODE_MASK_ALL?
> >
> > Thank you very much for the review. I sure can in the next version. To
> > be honest I thought about that and made the parameter nodemask_t
> > because I thought the call sites would be more readable. I.e. this:
> >
> > try_to_free_mem_cgroup_pages(memcg, 1, GFP_KERNEL,
> > MEMCG_RECLAIM_MAY_SWAP, NODE_MASK_ALL);
>
> nodemask_t is an array, which can be large depending on CONFIG_NODES_SHIFT.
> I don't think passing a big array is an efficient way. So I agree with Shakeel.
>
Ah, yes, I think the nodemask_t ends up compiling to something like:
typedef struct {
unsigned long name[BITS_TO_LONGS(MAX_NUMNODES)]
} nodemask_t;
If it was an array it would be passed by reference anway, but I think
if it is a struct containing an array the array will get copied
indeed. Sure, I will fix in the next version.
> Thanks.
>
> >
> > Would be more readable than this:
> >
> > try_to_free_mem_cgroup_pages(memcg, 1, GFP_KERNEL,
> > MEMCG_RECLAIM_MAY_SWAP, NULL);
> >
> > But the tradeoff is that the callers need include/linux/nodemask.h.
> > But yes I can fix in the next version.
> >
>
next prev parent reply other threads:[~2022-12-02 6:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 2:03 Mina Almasry
2022-11-30 8:44 ` Bagas Sanjaya
2022-11-30 19:45 ` Mina Almasry
2022-12-01 14:49 ` Michal Hocko
2022-12-01 21:32 ` Shakeel Butt
2022-12-01 22:10 ` Mina Almasry
2022-12-02 6:04 ` Muchun Song
2022-12-02 6:24 ` Mina Almasry [this message]
2022-12-02 3:25 ` Huang, Ying
2022-12-02 4:32 ` Mina Almasry
2022-12-05 1:45 ` Huang, Ying
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHS8izPCh+=iUMVP4Xa7FLXc=xtWc7VkLSpk2gugL=f0koBb=Q@mail.gmail.com' \
--to=almasrymina@google.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=fvdl@google.com \
--cc=gthelen@google.com \
--cc=hannes@cmpxchg.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizefan.x@bytedance.com \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeelb@google.com \
--cc=songmuchun@bytedance.com \
--cc=tim.c.chen@linux.intel.com \
--cc=tj@kernel.org \
--cc=weixugc@google.com \
--cc=yang.shi@linux.alibaba.com \
--cc=ying.huang@intel.com \
--cc=yosryahmed@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox