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:   Mon, 19 Oct 2020 22:58:12 +0800
From:   Muchun Song <songmuchun@...edance.com>
To:     Michal Hocko <mhocko@...e.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Stephen Rothwell <sfr@...b.auug.org.au>, osalvador@...e.de,
        alexander.h.duyck@...ux.intel.com, yang.shi@...ux.alibaba.com,
        David Hildenbrand <david@...hat.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Hugh Dickins <hughd@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Linux Memory Management List <linux-mm@...ck.org>
Subject: Re: [External] Re: [PATCH] mm/memory.c: Introduce non-atomic __{Set,Clear}PageSwapCache

On Mon, Oct 19, 2020 at 8:31 PM Michal Hocko <mhocko@...e.com> wrote:
>
> On Mon 19-10-20 18:15:20, Muchun Song wrote:
> > For the exclusive reference page, the non-atomic operations is enough,
> > so replace them to non-atomic operations.
>
> I do expect you do not see any difference in runtime and this is mostly
> driven by the code reading, right? Being explicit about this in the code
> would be preferred.

Yeah, just code reading.And the set_bit and __set_bit is actually different
on some architectures. Thanks.

>
> No objection to the change.
>
> > Signed-off-by: Muchun Song <songmuchun@...edance.com>
>
> With an improved changelog
> Acked-by: Michal Hocko <mhocko@...e.com>
>
> > ---
> >  include/linux/page-flags.h | 2 ++
> >  mm/memory.c                | 4 ++--
> >  2 files changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
> > index fbbb841a9346..ec039dde5e4b 100644
> > --- a/include/linux/page-flags.h
> > +++ b/include/linux/page-flags.h
> > @@ -401,6 +401,8 @@ static __always_inline int PageSwapCache(struct page *page)
> >  }
> >  SETPAGEFLAG(SwapCache, swapcache, PF_NO_TAIL)
> >  CLEARPAGEFLAG(SwapCache, swapcache, PF_NO_TAIL)
> > +__SETPAGEFLAG(SwapCache, swapcache, PF_NO_TAIL)
> > +__CLEARPAGEFLAG(SwapCache, swapcache, PF_NO_TAIL)
> >  #else
> >  PAGEFLAG_FALSE(SwapCache)
> >  #endif
> > diff --git a/mm/memory.c b/mm/memory.c
> > index 2d267ef6621a..02dd62da26e0 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -3128,10 +3128,10 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
> >                               set_page_private(page, entry.val);
> >
> >                               /* Tell memcg to use swap ownership records */
> > -                             SetPageSwapCache(page);
> > +                             __SetPageSwapCache(page);
> >                               err = mem_cgroup_charge(page, vma->vm_mm,
> >                                                       GFP_KERNEL);
> > -                             ClearPageSwapCache(page);
> > +                             __ClearPageSwapCache(page);
> >                               if (err) {
> >                                       ret = VM_FAULT_OOM;
> >                                       goto out_page;
> > --
> > 2.20.1
> >
>
> --
> Michal Hocko
> SUSE Labs



-- 
Yours,
Muchun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ