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 <teawat...@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 via email to