From patchwork Thu Jul 4 11:24:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13723634 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 0C7E7C31D97 for ; Thu, 4 Jul 2024 11:25:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 304226B00B7; Thu, 4 Jul 2024 07:25:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2651B6B00CE; Thu, 4 Jul 2024 07:25:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 106D96B00D2; Thu, 4 Jul 2024 07:25:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id DB0606B00CE for ; Thu, 4 Jul 2024 07:25:18 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7E100120E05 for ; Thu, 4 Jul 2024 11:25:17 +0000 (UTC) X-FDA: 82301839074.23.CB44BBD Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by imf25.hostedemail.com (Postfix) with ESMTP id 6F29AA001D for ; Thu, 4 Jul 2024 11:25:14 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=Y5J1X28w; spf=pass (imf25.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.130 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=1720092303; 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:in-reply-to:references:references:dkim-signature; bh=bjDtTTMdlmmldWh/OT1ZyYCpZPGPkV2gHwKUwOxuuNY=; b=bxASp7KomvKvd3ESdEqjTFK5aEM1qzc6fmhxcyeS5stchLcSzsHh+tgUOjYZOP2KF4kDbP 7QghIy+9+yEVRmSrY7bLxIcGQ15y9xJcwxIao0whYqy/NQDuR5IMDsTaKl4kGCqNcYXlFe 5oLFk9+OV8yrCsC2AM0fU3lwh8d9MKo= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=Y5J1X28w; spf=pass (imf25.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.130 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=1720092303; a=rsa-sha256; cv=none; b=nrFlpAKU0sQTylfwpqjSPMgDT+7I1743EmKiC8EZw6rr20Ua5NOfyvzy5HKFldbe5VaPDD PmGxdR9q4+RKVhChSzAXhM5REs6d4ZP9URKr3sEvhfwYAep82D7xFtod3j38TTqSrfHza/ 9YRn9XrPHycyl8qnxZm3Wm7uIDNdfYM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1720092311; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=bjDtTTMdlmmldWh/OT1ZyYCpZPGPkV2gHwKUwOxuuNY=; b=Y5J1X28wKMNtRfaK7um5XNoGpN7tcnRpI0PlJk7nqlI0dinzvUwc/BehRUquKftt0VwdYoeOG77zRTPRdhS+Z5kq0hj1YvVBn/e85yYH9ih+WBMZuIbV9caufnSBv+UFIYYjymBRqnIIvwcXTv+3kFgg0Lc6dAO5S42h355UAPw= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045220184;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---0W9qjOx8_1720092310; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W9qjOx8_1720092310) by smtp.aliyun-inc.com; Thu, 04 Jul 2024 19:25:10 +0800 From: Baolin Wang To: akpm@linux-foundation.org, hughd@google.com Cc: willy@infradead.org, david@redhat.com, wangkefeng.wang@huawei.com, chrisl@kernel.org, ying.huang@intel.com, 21cnbao@gmail.com, ryan.roberts@arm.com, shy828301@gmail.com, ziy@nvidia.com, ioworker0@gmail.com, da.gomez@samsung.com, p.raghav@samsung.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 03/10] mm: shmem: extend shmem_partial_swap_usage() to support large folio swap Date: Thu, 4 Jul 2024 19:24:52 +0800 Message-Id: <16b2d5360b0a5588c21508714b1afa50c874f307.1720079976.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 6F29AA001D X-Stat-Signature: o4y7tx8wrzr34dxq4hkiu4nm77ad7kix X-HE-Tag: 1720092314-307874 X-HE-Meta: U2FsdGVkX1/5DA+p5qCH+hXny6MJu+0SMZXnMXtLVJ5/CD1FxrPs64QCaPcayvHO5bpZ0RtCDOYHNH99vZgVoU6Z99u90m7yMMPXSzBPSZV9vs91xdGW3hr5577N5GzuoPA6V5E1+F3qZKkXpu80Mz2i3WgrKoZAi4oTUTJALY9vhLgS3KxGRWHAUkDed9l4/zGR/54FhnX1IYoaefvDUm0da7lKB8zWlDZzPIA53hLbjs2H4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: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: To support shmem large folio swapout in the following patches, using xa_get_order() to get the order of the swap entry to calculate the swap usage of shmem. Signed-off-by: Baolin Wang --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index 6244b909b069..42bf3176fa6c 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -881,7 +881,7 @@ unsigned long shmem_partial_swap_usage(struct address_space *mapping, if (xas_retry(&xas, page)) continue; if (xa_is_value(page)) - swapped++; + swapped += 1 << xa_get_order(xas.xa, xas.xa_index); if (xas.xa_index == max) break; if (need_resched()) {