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, 16 Nov 2017 09:46:14 +0900
From:   Minchan Kim <minchan@...nel.org>
To:     Shakeel Butt <shakeelb@...gle.com>
Cc:     Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
        Huang Ying <ying.huang@...el.com>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Vladimir Davydov <vdavydov.dev@...il.com>,
        Michal Hocko <mhocko@...nel.org>,
        Johannes Weiner <hannes@...xchg.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Greg Thelen <gthelen@...gle.com>,
        Linux MM <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] mm,vmscan: Kill global shrinker lock.

On Tue, Nov 14, 2017 at 10:28:10PM -0800, Shakeel Butt wrote:
> On Tue, Nov 14, 2017 at 4:56 PM, Minchan Kim <minchan@...nel.org> wrote:
> > On Tue, Nov 14, 2017 at 06:37:42AM +0900, Tetsuo Handa wrote:
> >> When shrinker_rwsem was introduced, it was assumed that
> >> register_shrinker()/unregister_shrinker() are really unlikely paths
> >> which are called during initialization and tear down. But nowadays,
> >> register_shrinker()/unregister_shrinker() might be called regularly.
> >> This patch prepares for allowing parallel registration/unregistration
> >> of shrinkers.
> >>
> >> Since do_shrink_slab() can reschedule, we cannot protect shrinker_list
> >> using one RCU section. But using atomic_inc()/atomic_dec() for each
> >> do_shrink_slab() call will not impact so much.
> >>
> >> This patch uses polling loop with short sleep for unregister_shrinker()
> >> rather than wait_on_atomic_t(), for we can save reader's cost (plain
> >> atomic_dec() compared to atomic_dec_and_test()), we can expect that
> >> do_shrink_slab() of unregistering shrinker likely returns shortly, and
> >> we can avoid khungtaskd warnings when do_shrink_slab() of unregistering
> >> shrinker unexpectedly took so long.
> >>
> >> Signed-off-by: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
> >
> > Before reviewing this patch, can't we solve the problem with more
> > simple way? Like this.
> >
> > Shakeel, What do you think?
> >
> 
> Seems simple enough. I will run my test (running fork bomb in one
> memcg and separately time a mount operation) and update if numbers
> differ significantly.

Thanks.

> 
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index 13d711dd8776..cbb624cb9baa 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -498,6 +498,14 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid,
> >                         sc.nid = 0;
> >
> >                 freed += do_shrink_slab(&sc, shrinker, nr_scanned, nr_eligible);
> > +               /*
> > +                * bail out if someone want to register a new shrinker to prevent
> > +                * long time stall by parallel ongoing shrinking.
> > +                */
> > +               if (rwsem_is_contended(&shrinker_rwsem)) {
> > +                       freed = 1;
> 
> freed = freed ?: 1;

Yub.

Powered by blists - more mailing lists