linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@fb.com>
To: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
	<akpm@linux-foundation.org>
Cc: <matthew.wilcox@oracle.com>, <kernel-team@fb.com>,
	<william.kucharski@oracle.com>, <kirill.shutemov@linux.intel.com>,
	Song Liu <songliubraving@fb.com>
Subject: [PATCH v2 2/5] mm/thp: fix node page state in split_huge_page_to_list()
Date: Thu, 17 Oct 2019 09:42:19 -0700	[thread overview]
Message-ID: <20191017164223.2762148-3-songliubraving@fb.com> (raw)
In-Reply-To: <20191017164223.2762148-1-songliubraving@fb.com>

From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>

Make sure split_huge_page_to_list() handle the state of shmem THP and
file THP properly.

Fixes: 60fbf0ab5da1 ("mm,thp: stats for file backed THP")
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Tested-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
---
 mm/huge_memory.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index c5cb6dcd6c69..13cc93785006 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2789,8 +2789,13 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
 			ds_queue->split_queue_len--;
 			list_del(page_deferred_list(head));
 		}
-		if (mapping)
-			__dec_node_page_state(page, NR_SHMEM_THPS);
+		if (mapping) {
+			if (PageSwapBacked(page))
+				__dec_node_page_state(page, NR_SHMEM_THPS);
+			else
+				__dec_node_page_state(page, NR_FILE_THPS);
+		}
+
 		spin_unlock(&ds_queue->split_queue_lock);
 		__split_huge_page(page, list, end, flags);
 		if (PageSwapCache(head)) {
-- 
2.17.1



  parent reply	other threads:[~2019-10-17 16:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 16:42 [PATCH v2 0/5] Fixes for THP in page cache Song Liu
2019-10-17 16:42 ` [PATCH v2 1/5] proc/meminfo: fix output alignment Song Liu
2019-10-17 17:37   ` Yang Shi
2019-10-17 16:42 ` Song Liu [this message]
2019-10-17 17:38   ` [PATCH v2 2/5] mm/thp: fix node page state in split_huge_page_to_list() Yang Shi
2019-10-17 16:42 ` [PATCH v2 3/5] mm: Support removing arbitrary sized pages from mapping Song Liu
2019-10-17 17:43   ` Yang Shi
2019-10-17 16:42 ` [PATCH v2 4/5] mm/thp: allow drop THP from page cache Song Liu
2019-10-17 21:46   ` Yang Shi
2019-10-18 13:32     ` Kirill A. Shutemov
2019-10-18 21:54       ` Yang Shi
2019-10-17 16:42 ` [PATCH v2 5/5] uprobe: only do FOLL_SPLIT_PMD for uprobe register Song Liu
2019-10-18 12:52   ` Srikar Dronamraju

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=20191017164223.2762148-3-songliubraving@fb.com \
    --to=songliubraving@fb.com \
    --cc=akpm@linux-foundation.org \
    --cc=kernel-team@fb.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=matthew.wilcox@oracle.com \
    --cc=william.kucharski@oracle.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