linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Muchun Song <songmuchun@bytedance.com>
To: gregkh@linuxfoundation.org, rafael@kernel.org,
	adobriyan@gmail.com, akpm@linux-foundation.org,
	hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com,
	hughd@google.com, shakeelb@google.com, guro@fb.com,
	samitolvanen@google.com, feng.tang@intel.com, neilb@suse.de,
	iamjoonsoo.kim@lge.com, rdunlap@infradead.org
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-mm@kvack.org, cgroups@vger.kernel.org,
	Muchun Song <songmuchun@bytedance.com>,
	Michal Hocko <mhocko@suse.com>
Subject: [PATCH v3 1/7] mm: memcontrol: fix NR_ANON_THPS account
Date: Tue,  8 Dec 2020 12:18:41 +0800	[thread overview]
Message-ID: <20201208041847.72122-2-songmuchun@bytedance.com> (raw)
In-Reply-To: <20201208041847.72122-1-songmuchun@bytedance.com>

The unit of NR_ANON_THPS is HPAGE_PMD_NR already. So it should inc/dec
by one rather than nr_pages.

Fixes: 468c398233da ("mm: memcontrol: switch to native NR_ANON_THPS counter")
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Acked-by: Michal Hocko <mhocko@suse.com>
---
 mm/memcontrol.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index b80328f52fb4..8818bf64d6fe 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5653,10 +5653,8 @@ static int mem_cgroup_move_account(struct page *page,
 			__mod_lruvec_state(from_vec, NR_ANON_MAPPED, -nr_pages);
 			__mod_lruvec_state(to_vec, NR_ANON_MAPPED, nr_pages);
 			if (PageTransHuge(page)) {
-				__mod_lruvec_state(from_vec, NR_ANON_THPS,
-						   -nr_pages);
-				__mod_lruvec_state(to_vec, NR_ANON_THPS,
-						   nr_pages);
+				__dec_lruvec_state(from_vec, NR_ANON_THPS);
+				__inc_lruvec_state(to_vec, NR_ANON_THPS);
 			}
 
 		}
-- 
2.11.0


  reply	other threads:[~2020-12-08  4:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08  4:18 [PATCH v3 0/7] Convert all THP vmstat counters to pages Muchun Song
2020-12-08  4:18 ` Muchun Song [this message]
2020-12-09  1:58   ` [PATCH v3 1/7] mm: memcontrol: fix NR_ANON_THPS account Roman Gushchin
2020-12-08  4:18 ` [PATCH v3 2/7] mm: memcontrol: convert NR_ANON_THPS account to pages Muchun Song
2020-12-15 13:30   ` Michal Hocko
2020-12-15 13:37     ` [External] " Muchun Song
2020-12-08  4:18 ` [PATCH v3 3/7] mm: memcontrol: convert NR_FILE_THPS " Muchun Song
2020-12-08  4:18 ` [PATCH v3 4/7] mm: memcontrol: convert NR_SHMEM_THPS " Muchun Song
2020-12-08  4:18 ` [PATCH v3 5/7] mm: memcontrol: convert NR_SHMEM_PMDMAPPED " Muchun Song
2020-12-08  4:18 ` [PATCH v3 6/7] mm: memcontrol: convert NR_FILE_PMDMAPPED " Muchun Song
2020-12-08  4:18 ` [PATCH v3 7/7] mm: memcontrol: make the slab calculation consistent Muchun Song
2020-12-08  7:20   ` Pankaj Gupta
2020-12-08  7:53     ` [External] " Muchun Song
2020-12-15 13:35   ` Michal Hocko
2020-12-15 16:21     ` [External] " Muchun Song

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=20201208041847.72122-2-songmuchun@bytedance.com \
    --to=songmuchun@bytedance.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=feng.tang@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=neilb@suse.de \
    --cc=rafael@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=samitolvanen@google.com \
    --cc=shakeelb@google.com \
    --cc=vdavydov.dev@gmail.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).