Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5432904ybp; Mon, 14 Oct 2019 22:39:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHXLwnSGnOvcK8VswHktHjEf+Awv4fhrrEn+ArNf2GnUU+WVP4Kr71kks4GWRNyLKhtyih X-Received: by 2002:a05:6402:b02:: with SMTP id bm2mr31830632edb.244.1571117970959; Mon, 14 Oct 2019 22:39:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571117970; cv=none; d=google.com; s=arc-20160816; b=IJyTsAo7SgzSzje4bVn14oia7kKBgSF7NNllo+m6qiRB8cc5IoxV85FahFTVu6rPVs vBWgM3/+q3Mr8KBgXvsOydZC0+yJ39xhYF3dY5k7ntSmdgRN37LjrpNuaFc7+GNiy/Jb m+MeA94NFHBoGJt5TmhItQ6SFyqyNf+LggjG5NRZ/iqdKxPaiwxy7NfvOBXt4ox5cA+b pYSp5sCXVdH9JsELvZ1ckB7dJ5vrPVmYR93Ih1RODu/jNu+mpjG9GbOqgzYfEH8o9ORU SeuhlmFRyd7lB0ZPpPQzcrR9zIMUuZ+R4qOGziZfqP2xwKyiTD99UuVZ7C6F5qRhEqs+ j1oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=8a8D8usqdTZe2yBPdJqcArQuv6zy/ZwbgKunZI8J3/Q=; b=tU5fbUXn3DxioCHN0YzLi6QY8zs6sN5cxLDUceBmBAoFJZ0VVFBSUMz9ux6oH38qDA HkO+vV2rcJSHNDtrYCJdBOWf1CP3fB1jkAPNdYFAN2G4DplP6lHtRPuVk4jzFP6xeH/B 2UUArQrCgvcugwdLAhbMGwDtaE7cx5AD4Og8EcOxOiZqZWmVX1y50qAYgQdZtfMhCeyL XF7nrgq1i7MMIzkkaO9zZ2i16eiS71359TDIyIR9PgGbxEGiZXhecNcXoqA9XTNzEz77 VXtzUzviIw2Bd2KFWwEMzkG+fhUg4lwvgC7SwtP2NSYNLw7ebXBneTcub44/1b60wVN4 wDWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p39si13671727eda.416.2019.10.14.22.39.07; Mon, 14 Oct 2019 22:39:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728010AbfJODtb (ORCPT + 99 others); Mon, 14 Oct 2019 23:49:31 -0400 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:35513 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727092AbfJODta (ORCPT ); Mon, 14 Oct 2019 23:49:30 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=teawaterz@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0Tf5lel1_1571111361; Received: from localhost(mailfrom:teawaterz@linux.alibaba.com fp:SMTPD_---0Tf5lel1_1571111361) by smtp.aliyun-inc.com(127.0.0.1); Tue, 15 Oct 2019 11:49:27 +0800 From: Hui Zhu To: konrad.wilk@oracle.com, sjenning@redhat.com, ddstreet@ieee.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Hui Zhu , Hui Zhu 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> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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