From patchwork Mon Aug 19 08:14:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13768055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C122EC3DA4A for ; Mon, 19 Aug 2024 08:14:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 523966B007B; Mon, 19 Aug 2024 04:14:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D0856B0083; Mon, 19 Aug 2024 04:14:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 34A3B6B008A; Mon, 19 Aug 2024 04:14:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 17F676B007B for ; Mon, 19 Aug 2024 04:14:53 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B407814109E for ; Mon, 19 Aug 2024 08:14:52 +0000 (UTC) X-FDA: 82468284024.08.6F47BF9 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by imf07.hostedemail.com (Postfix) with ESMTP id 026BA40022 for ; Mon, 19 Aug 2024 08:14:49 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=gRCzoSJB; spf=pass (imf07.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.101 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724055230; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=jorS/OAhi2o1DqE879TPVDZXm17fL6EjvHqpR3pvR7U=; b=q3oNTVv+D6oPGJH1G3bKKsFPQX2fQQnB2RHiGdP9ytocZPrlOk4C7KZ694+QxNk07yaNqb EAinNu7kyZ77b/yIuQFGNuupVV6R/kuXUEZ0sGHWikAIFhOt80d3UNozk4KVsGFoW7Yqm+ ltOSUClvcf21oE6YIbdEstzUCW2Y/2Q= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=gRCzoSJB; spf=pass (imf07.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.101 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724055230; a=rsa-sha256; cv=none; b=pxXTW7FYKRFMojfdLwpM9UVjfskWF8Ea9hWYjxk9uwS05XgZTt+BbPhDXO8xzLyIFnLuCS hIvHy5mLz1Cxhg6nVVPUeEfi3KK5rBTW0vdW7NvctfQ6vqM2RrUNZeJXOdvdPBV4as5JFd 9zWDhfgPrfkQkILd7918gN4V+6SJx1A= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1724055286; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=jorS/OAhi2o1DqE879TPVDZXm17fL6EjvHqpR3pvR7U=; b=gRCzoSJBofCGyZNbKAT3JtrL/dRIgpVN5BlBKRHzbvKOkdZii+6LOTwxyNxLllB2KsZpNW44D8aEkrf5u62lpK33dYfZRu1A0AwwbUhxrnE1pT0MneOcB/NfsTYWkDMn0TQIOAcDPTIIyez9DL+DtL7sryZjqjq4ZTOZkKl6ocI= Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WD9CrH._1724055284) by smtp.aliyun-inc.com; Mon, 19 Aug 2024 16:14:45 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: hughd@google.com, willy@infradead.org, david@redhat.com, 21cnbao@gmail.com, ryan.roberts@arm.com, shy828301@gmail.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/5] support shmem mTHP collapse Date: Mon, 19 Aug 2024 16:14:01 +0800 Message-Id: X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Stat-Signature: 7aer4a9epccyihggsfd78476a9tnopiu X-Rspam-User: X-Rspamd-Queue-Id: 026BA40022 X-Rspamd-Server: rspam02 X-HE-Tag: 1724055289-990438 X-HE-Meta: U2FsdGVkX1/9tNU50SGHMDqXUAVIS0/nZNoe2BeXtrGDRtO5OOXBbWt8RA1WIpEHfQ5Ysj3KuYwexZpzFuLTEz7SXRgy6skfzXzHBzNug1ss4hqiUGso37ItK6IeZxm9D5YBWYMWv+B1OIg8R57W8Y8WT/A6K0YKFgfWm4IcF2k4x4kA4nGRN6GYNb9OHUgW2l838s/TA92/jlYxOA0vc1W8fvCE2ujog0ILFWAypFF6WpA3JJ5oDB39OpXgi4fY5QGfnib7KPvb20TgQRNoq1I0YHx8eBu2YxOoj+Q/NF5hiDgV//7GeTO911bU5XmrDn16EOi+me+PfrNVoEKEanif9IvuIqreSBxPnmBKT3Trv+h4meXtAQMuB/l1BqF13nCt9wydcd60x2YyFOka+mc6t4ZHJKSnl6VjcX5JDpxQdJCBKpj5TzZ8XCVVrOiDzz0RUhQGikpeRA6e8bcBgAh9Mw+1JczRjrlHIedosqhPc+b9tLYDtU6vAU6QJ9x7JjqeFIf67+gvbMeP+D5wfW7pXEHiwSFBpmdHZHUVp6ccwkwsE4FmP5hlLfLldFiDmLwXITnLNChGjmi7EdO82c4FtxMtfF1O41KpOGx1Zu8EBS65eNgcri2Yx8RihzlOeZrhJSIgb43rU4nSfOPv3b3ivNKeai1gJ/lwgDMjT+duvLGmDeQavu1YfrD7mNEE2nTijvf2dfRA8zQHUeEqPVDjZRAjpB/78xwh+VueGwx7AYseznJ3R1XY4SbpjHk/9KIoJFWXun9M3vtfEs4mH96dsW58O826u+5GyY3O9XQIZtFu6/26SYLqtVIdXJ1ZD6IJ6+7JO0x9NIAQ/5wAaLoLMEFwCLN/sA7iGFmkqUNBvPZG7ZM0p/YAHgdxJgexsPDWO2pkkDGE0nZLTUKSLHqqPvVlerzcnS93UpncDDcI9jc8XIiXy7AIAkGZX+M5kXlqC0KfUpI8ZS/19CC Iji62EDX JvHIsaS+pBX0l7c/c9KA2iZSx9zhnUyiLM2b7nZgvJkf5inc+QfaHOOJFbn0lk4bP9CxGC4HVbhbl9c1nAt+zkbAdQ2at3+r7MGCS90eMCnzxv7DZmWPDq3Xawoo/LZpqlnZ/6m8Yz1++ey7FgPRGXPtiiKsONjjnEpTNYUM+vp8FqlEra+08BM6EfSLBzbZPbkJI2kUER5W9e7/vWmMOV/p6GqbKDOaTwBlPv9jDEHKml0SBmqJj9jCE2I/Nlo+DZB1Y X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi, Shmem already supports mTHP allocation[1], and this patch set adds support for shmem mTHP collapse, as well as adding relevant test cases. Please help to review. Thanks. Note: all khugepaged selftests have passed. [1] https://lore.kernel.org/all/cover.1718090413.git.baolin.wang@linux.alibaba.com/T/#m4bd7e701c7b5f36f712055e4360cad593a22b3bf Baolin Wang (5): mm: khugepaged: expand the is_refcount_suitable() to support file folios mm: khugepaged: use the number of pages in the folio to check the reference count mm: khugepaged: support shmem mTHP copy mm: khugepaged: support shmem mTHP collapse selftests: mm: support shmem mTHP collapse testing mm/khugepaged.c | 60 ++++++++++++----------- tools/testing/selftests/mm/khugepaged.c | 4 +- tools/testing/selftests/mm/thp_settings.c | 46 ++++++++++++++--- tools/testing/selftests/mm/thp_settings.h | 9 +++- 4 files changed, 83 insertions(+), 36 deletions(-)