From: Muchun Song <songmuchun@bytedance.com>
To: Michal Hocko <mhocko@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
osalvador@suse.de, alexander.h.duyck@linux.intel.com,
yang.shi@linux.alibaba.com, David Hildenbrand <david@redhat.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Hugh Dickins <hughd@google.com>,
LKML <linux-kernel@vger.kernel.org>,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [External] Re: [PATCH] mm/memory.c: Introduce non-atomic __{Set,Clear}PageSwapCache
Date: Mon, 19 Oct 2020 22:58:12 +0800 [thread overview]
Message-ID: <CAMZfGtVa7n_W2QYA1a8xM3HFtPne8XcWDObytEujO47CBkwYWw@mail.gmail.com> (raw)
In-Reply-To: <20201019123137.GG27114@dhcp22.suse.cz>
On Mon, Oct 19, 2020 at 8:31 PM Michal Hocko <mhocko@suse.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@bytedance.com>
>
> With an improved changelog
> Acked-by: Michal Hocko <mhocko@suse.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
next prev parent reply other threads:[~2020-10-19 14:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-19 10:15 [PATCH] mm/memory.c: Introduce non-atomic __{Set,Clear}PageSwapCache Muchun Song
2020-10-19 12:31 ` Michal Hocko
2020-10-19 14:58 ` Muchun Song [this message]
2020-10-20 11:50 ` [External] " Xu, Yanfei
2020-10-20 13:08 ` Muchun Song
2020-10-21 2:52 ` Xu, Yanfei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMZfGtVa7n_W2QYA1a8xM3HFtPne8XcWDObytEujO47CBkwYWw@mail.gmail.com \
--to=songmuchun@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.h.duyck@linux.intel.com \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=osalvador@suse.de \
--cc=sfr@canb.auug.org.au \
--cc=yang.shi@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).