Linux-mm Archive on lore.kernel.org
 help / color / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: konrad.wilk@oracle.com, sjenning@redhat.com, ddstreet@ieee.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: Hui Zhu <teawater@gmail.com>, Hui Zhu <teawaterz@linux.alibaba.com>
Subject: [PATCH 1/2] mm, frontswap: Fix frontswap_map issue with THP
Date: Tue, 15 Oct 2019 11:49:08 +0800
Message-ID: <1571111349-5041-1-git-send-email-teawater@gmail.com> (raw)

Shrink will try to use frontswap interface store the THP as a normal
page in __frontswap_store:
	if (ret == 0) {
		__frontswap_set(sis, offset);
		inc_frontswap_succ_stores();
	} else {
It should set all bits with THP.

This commit set all bits with THP.

Signed-off-by: Hui Zhu <teawaterz@linux.alibaba.com>
---
 mm/frontswap.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mm/frontswap.c b/mm/frontswap.c
index 60bb20e..f07ea63 100644
--- a/mm/frontswap.c
+++ b/mm/frontswap.c
@@ -274,8 +274,12 @@ int __frontswap_store(struct page *page)
 			break;
 	}
 	if (ret == 0) {
-		__frontswap_set(sis, offset);
-		inc_frontswap_succ_stores();
+		int i, nr = hpage_nr_pages(page);
+
+		for (i = 0; i < nr; i++) {
+			__frontswap_set(sis, offset + i);
+			inc_frontswap_succ_stores();
+		}
 	} else {
 		inc_frontswap_failed_stores();
 	}
-- 
2.7.4



             reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15  3:49 Hui Zhu [this message]
2019-10-15  3:49 ` [PATCH 2/2] mm, zswap: Support THP Hui Zhu
2019-11-08 16:15   ` Dan Streetman
2019-11-11  1:48     ` Hui Zhu

Reply instructions:

You may reply publically 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=1571111349-5041-1-git-send-email-teawater@gmail.com \
    --to=teawater@gmail.com \
    --cc=ddstreet@ieee.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sjenning@redhat.com \
    --cc=teawaterz@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

Linux-mm Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mm/0 linux-mm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mm linux-mm/ https://lore.kernel.org/linux-mm \
		linux-mm@kvack.org
	public-inbox-index linux-mm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kvack.linux-mm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git