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]
Message-ID: <20210210012932.GP524633@carbon.DHCP.thefacebook.com>
Date:   Tue, 9 Feb 2021 17:29:32 -0800
From:   Roman Gushchin <guro@...com>
To:     Yang Shi <shy828301@...il.com>
CC:     Kirill Tkhai <ktkhai@...tuozzo.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        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: [v7 PATCH 06/12] mm: vmscan: add shrinker_info_protected() helper

On Tue, Feb 09, 2021 at 05:07:07PM -0800, Yang Shi wrote:
> On Tue, Feb 9, 2021 at 4:22 PM Roman Gushchin <guro@...com> wrote:
> >
> > On Tue, Feb 09, 2021 at 09:46:40AM -0800, Yang Shi wrote:
> > > The shrinker_info is dereferenced in a couple of places via rcu_dereference_protected
> > > with different calling conventions, for example, using mem_cgroup_nodeinfo helper
> > > or dereferencing memcg->nodeinfo[nid]->shrinker_info.  And the later patch
> > > will add more dereference places.
> > >
> > > So extract the dereference into a helper to make the code more readable.  No
> > > functional change.
> > >
> > > Signed-off-by: Yang Shi <shy828301@...il.com>
> > > ---
> > >  mm/vmscan.c | 15 ++++++++++-----
> > >  1 file changed, 10 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > > index 9436f9246d32..273efbf4d53c 100644
> > > --- a/mm/vmscan.c
> > > +++ b/mm/vmscan.c
> > > @@ -190,6 +190,13 @@ static int shrinker_nr_max;
> > >  #define NR_MAX_TO_SHR_MAP_SIZE(nr_max) \
> > >       (DIV_ROUND_UP(nr_max, BITS_PER_LONG) * sizeof(unsigned long))
> > >
> > > +static struct shrinker_info *shrinker_info_protected(struct mem_cgroup *memcg,
> > > +                                                  int nid)
> > > +{
> > > +     return rcu_dereference_protected(memcg->nodeinfo[nid]->shrinker_info,
> > > +                                      lockdep_is_held(&shrinker_rwsem));
> > > +}
> > > +
> >
> >
> > I'd probably drop the "protected" suffix (because there is no unprotected version,
> > right?).
> 
> No, actually there is one "unprotected" call in set_shrinker_bit().

Ah, ok. Then it makes sense. Sorry.

> 
> >
> > Other than that LGTM.
> >
> > Acked-by: Roman Gushchin <guro@...com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ