From: Hugh Dickins <hughd@google.com> To: Johannes Weiner <hannes@cmpxchg.org> Cc: Andrew Morton <akpm@linux-foundation.org>, Linus Torvalds <torvalds@linux-foundation.org>, Hugh Dickins <hughd@google.com>, Shakeel Butt <shakeelb@google.com>, Michal Hocko <mhocko@suse.com>, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] mm: rmap: remove lock_page_memcg() Date: Tue, 6 Dec 2022 17:52:30 -0800 (PST) [thread overview] Message-ID: <424a805a-28b8-afe1-ad61-f4fdc42aaa8@google.com> (raw) In-Reply-To: <20221206171340.139790-3-hannes@cmpxchg.org> On Tue, 6 Dec 2022, Johannes Weiner wrote: > The previous patch made sure charge moving only touches pages for > which page_mapped() is stable. lock_page_memcg() is no longer needed. > > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Hugh Dickins <hughd@google.com> > --- > mm/rmap.c | 26 ++++++++------------------ > 1 file changed, 8 insertions(+), 18 deletions(-) > > diff --git a/mm/rmap.c b/mm/rmap.c > index b616870a09be..32e48b1c5847 100644 > --- a/mm/rmap.c > +++ b/mm/rmap.c > @@ -1222,9 +1222,6 @@ void page_add_anon_rmap(struct page *page, > bool compound = flags & RMAP_COMPOUND; > bool first = true; > > - if (unlikely(PageKsm(page))) > - lock_page_memcg(page); > - > /* Is page being mapped by PTE? Is this its first map to be added? */ > if (likely(!compound)) { > first = atomic_inc_and_test(&page->_mapcount); > @@ -1262,15 +1259,14 @@ void page_add_anon_rmap(struct page *page, > if (nr) > __mod_lruvec_page_state(page, NR_ANON_MAPPED, nr); > > - if (unlikely(PageKsm(page))) > - unlock_page_memcg(page); > - > - /* address might be in next vma when migration races vma_adjust */ > - else if (first) > - __page_set_anon_rmap(page, vma, address, > - !!(flags & RMAP_EXCLUSIVE)); > - else > - __page_check_anon_rmap(page, vma, address); > + if (likely(!PageKsm(page))) { > + /* address might be in next vma when migration races vma_adjust */ > + if (first) > + __page_set_anon_rmap(page, vma, address, > + !!(flags & RMAP_EXCLUSIVE)); > + else > + __page_check_anon_rmap(page, vma, address); > + } > > mlock_vma_page(page, vma, compound); > } > @@ -1329,7 +1325,6 @@ void page_add_file_rmap(struct page *page, > bool first; > > VM_BUG_ON_PAGE(compound && !PageTransHuge(page), page); > - lock_page_memcg(page); > > /* Is page being mapped by PTE? Is this its first map to be added? */ > if (likely(!compound)) { > @@ -1365,7 +1360,6 @@ void page_add_file_rmap(struct page *page, > NR_SHMEM_PMDMAPPED : NR_FILE_PMDMAPPED, nr_pmdmapped); > if (nr) > __mod_lruvec_page_state(page, NR_FILE_MAPPED, nr); > - unlock_page_memcg(page); > > mlock_vma_page(page, vma, compound); > } > @@ -1394,8 +1388,6 @@ void page_remove_rmap(struct page *page, > return; > } > > - lock_page_memcg(page); > - > /* Is page being unmapped by PTE? Is this its last map to be removed? */ > if (likely(!compound)) { > last = atomic_add_negative(-1, &page->_mapcount); > @@ -1451,8 +1443,6 @@ void page_remove_rmap(struct page *page, > * and remember that it's only reliable while mapped. > */ > > - unlock_page_memcg(page); > - > munlock_vma_page(page, vma, compound); > } > > -- > 2.38.1 > >
WARNING: multiple messages have this Message-ID (diff)
From: Hugh Dickins <hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> To: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org> Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>, Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>, Hugh Dickins <hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>, Shakeel Butt <shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>, Michal Hocko <mhocko-IBi9RG/b67k@public.gmane.org>, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Subject: Re: [PATCH 2/3] mm: rmap: remove lock_page_memcg() Date: Tue, 6 Dec 2022 17:52:30 -0800 (PST) [thread overview] Message-ID: <424a805a-28b8-afe1-ad61-f4fdc42aaa8@google.com> (raw) In-Reply-To: <20221206171340.139790-3-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org> On Tue, 6 Dec 2022, Johannes Weiner wrote: > The previous patch made sure charge moving only touches pages for > which page_mapped() is stable. lock_page_memcg() is no longer needed. > > Signed-off-by: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org> Acked-by: Hugh Dickins <hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> > --- > mm/rmap.c | 26 ++++++++------------------ > 1 file changed, 8 insertions(+), 18 deletions(-) > > diff --git a/mm/rmap.c b/mm/rmap.c > index b616870a09be..32e48b1c5847 100644 > --- a/mm/rmap.c > +++ b/mm/rmap.c > @@ -1222,9 +1222,6 @@ void page_add_anon_rmap(struct page *page, > bool compound = flags & RMAP_COMPOUND; > bool first = true; > > - if (unlikely(PageKsm(page))) > - lock_page_memcg(page); > - > /* Is page being mapped by PTE? Is this its first map to be added? */ > if (likely(!compound)) { > first = atomic_inc_and_test(&page->_mapcount); > @@ -1262,15 +1259,14 @@ void page_add_anon_rmap(struct page *page, > if (nr) > __mod_lruvec_page_state(page, NR_ANON_MAPPED, nr); > > - if (unlikely(PageKsm(page))) > - unlock_page_memcg(page); > - > - /* address might be in next vma when migration races vma_adjust */ > - else if (first) > - __page_set_anon_rmap(page, vma, address, > - !!(flags & RMAP_EXCLUSIVE)); > - else > - __page_check_anon_rmap(page, vma, address); > + if (likely(!PageKsm(page))) { > + /* address might be in next vma when migration races vma_adjust */ > + if (first) > + __page_set_anon_rmap(page, vma, address, > + !!(flags & RMAP_EXCLUSIVE)); > + else > + __page_check_anon_rmap(page, vma, address); > + } > > mlock_vma_page(page, vma, compound); > } > @@ -1329,7 +1325,6 @@ void page_add_file_rmap(struct page *page, > bool first; > > VM_BUG_ON_PAGE(compound && !PageTransHuge(page), page); > - lock_page_memcg(page); > > /* Is page being mapped by PTE? Is this its first map to be added? */ > if (likely(!compound)) { > @@ -1365,7 +1360,6 @@ void page_add_file_rmap(struct page *page, > NR_SHMEM_PMDMAPPED : NR_FILE_PMDMAPPED, nr_pmdmapped); > if (nr) > __mod_lruvec_page_state(page, NR_FILE_MAPPED, nr); > - unlock_page_memcg(page); > > mlock_vma_page(page, vma, compound); > } > @@ -1394,8 +1388,6 @@ void page_remove_rmap(struct page *page, > return; > } > > - lock_page_memcg(page); > - > /* Is page being unmapped by PTE? Is this its last map to be removed? */ > if (likely(!compound)) { > last = atomic_add_negative(-1, &page->_mapcount); > @@ -1451,8 +1443,6 @@ void page_remove_rmap(struct page *page, > * and remember that it's only reliable while mapped. > */ > > - unlock_page_memcg(page); > - > munlock_vma_page(page, vma, compound); > } > > -- > 2.38.1 > >
next prev parent reply other threads:[~2022-12-07 1:54 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-12-06 17:13 [PATCH v2 0/3] mm: push down lock_page_memcg() Johannes Weiner 2022-12-06 17:13 ` Johannes Weiner 2022-12-06 17:13 ` [PATCH 1/3] mm: memcontrol: skip moving non-present pages that are mapped elsewhere Johannes Weiner 2022-12-06 17:13 ` Johannes Weiner 2022-12-07 1:51 ` Hugh Dickins 2022-12-08 0:36 ` Shakeel Butt 2022-12-08 0:36 ` Shakeel Butt 2022-12-06 17:13 ` [PATCH 2/3] mm: rmap: remove lock_page_memcg() Johannes Weiner 2022-12-06 17:13 ` Johannes Weiner 2022-12-07 1:52 ` Hugh Dickins [this message] 2022-12-07 1:52 ` Hugh Dickins 2022-12-08 0:36 ` Shakeel Butt 2022-12-06 17:13 ` [PATCH 3/3] mm: memcontrol: deprecate charge moving Johannes Weiner 2022-12-06 17:13 ` Johannes Weiner 2022-12-07 0:03 ` Shakeel Butt 2022-12-07 0:03 ` Shakeel Butt 2022-12-07 21:51 ` Andrew Morton 2022-12-07 21:51 ` Andrew Morton 2022-12-07 22:15 ` Shakeel Butt 2022-12-07 22:15 ` Shakeel Butt 2022-12-07 1:58 ` Hugh Dickins 2022-12-07 1:58 ` Hugh Dickins 2022-12-07 13:00 ` Johannes Weiner 2022-12-07 13:00 ` Johannes Weiner 2022-12-07 14:07 ` [PATCH v2 0/3] mm: push down lock_page_memcg() Michal Hocko
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=424a805a-28b8-afe1-ad61-f4fdc42aaa8@google.com \ --to=hughd@google.com \ --cc=akpm@linux-foundation.org \ --cc=cgroups@vger.kernel.org \ --cc=hannes@cmpxchg.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mhocko@suse.com \ --cc=shakeelb@google.com \ --cc=torvalds@linux-foundation.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.