lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 1 Dec 2022 22:24:14 -0800
From:   Mina Almasry <almasrymina@...gle.com>
To:     Muchun Song <muchun.song@...ux.dev>
Cc:     Shakeel Butt <shakeelb@...gle.com>,
        Huang Ying <ying.huang@...el.com>,
        Yang Shi <yang.shi@...ux.alibaba.com>,
        Yosry Ahmed <yosryahmed@...gle.com>,
        Tim Chen <tim.c.chen@...ux.intel.com>, weixugc@...gle.com,
        gthelen@...gle.com, fvdl@...gle.com, Tejun Heo <tj@...nel.org>,
        Zefan Li <lizefan.x@...edance.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Jonathan Corbet <corbet@....net>,
        Michal Hocko <mhocko@...nel.org>,
        Roman Gushchin <roman.gushchin@...ux.dev>,
        Muchun Song <songmuchun@...edance.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        cgroups@...r.kernel.org,
        Linux Doc Mailing List <linux-doc@...r.kernel.org>,
        linux-kernel@...r.kernel.org,
        Linux Memory Management List <linux-mm@...ck.org>
Subject: Re: [RFC PATCH v2] mm: Add nodes= arg to memory.reclaim

On Thu, Dec 1, 2022 at 10:05 PM Muchun Song <muchun.song@...ux.dev> wrote:
>
>
>
> > On Dec 2, 2022, at 06:10, Mina Almasry <almasrymina@...gle.com> wrote:
> >
> > On Thu, Dec 1, 2022 at 1:32 PM Shakeel Butt <shakeelb@...gle.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.
> >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ