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] [day] [month] [year] [list]
Message-ID: <CAHbLzkpCLxzy-whY8jiSw59V-tmq=VgDuxyUcdRkWrgkZnxC2w@mail.gmail.com>
Date:   Mon, 1 Feb 2021 09:09:45 -0800
From:   Yang Shi <shy828301@...il.com>
To:     Vlastimil Babka <vbabka@...e.cz>
Cc:     Roman Gushchin <guro@...com>, Kirill Tkhai <ktkhai@...tuozzo.com>,
        Shakeel Butt <shakeelb@...gle.com>,
        Dave Chinner <david@...morbit.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Michal Hocko <mhocko@...e.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux MM <linux-mm@...ck.org>,
        Linux FS-devel Mailing List <linux-fsdevel@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [v5 PATCH 07/11] mm: vmscan: add per memcg shrinker nr_deferred

On Mon, Feb 1, 2021 at 7:17 AM Vlastimil Babka <vbabka@...e.cz> wrote:
>
> On 1/29/21 7:04 PM, Yang Shi wrote:
>
> >> > > @@ -209,9 +214,15 @@ static int expand_one_shrinker_info(struct mem_cgroup *memcg,
> >> > >               if (!new)
> >> > >                       return -ENOMEM;
> >> > >
> >> > > -             /* Set all old bits, clear all new bits */
> >> > > -             memset(new->map, (int)0xff, old_size);
> >> > > -             memset((void *)new->map + old_size, 0, size - old_size);
> >> > > +             new->map = (unsigned long *)(new + 1);
> >> > > +             new->nr_deferred = (void *)new->map + m_size;
> >> >
> >> > This better be aligned to sizeof(atomic_long_t). Can we be sure about that?
> >>
> >> Good point. No, if unsigned long is 32 bit on some 64 bit machines.
> >
> > I think we could just change map to "u64" and guarantee struct
> > shrinker_info is aligned to 64 bit.
>
> What about changing to order, nr_deferred before map? Then the atomics are at
> the beginning of allocated area, thus aligned.

Yes, it works too. The rcu_head is guaranteed to have aligned at sizeof(void *).

Will fix in v6.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ