From mboxrd@z Thu Jan 1 00:00:00 1970 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 5CA5DC021AA for ; Wed, 19 Feb 2025 10:05:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CDBB244014A; Wed, 19 Feb 2025 05:05:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C8B1528021F; Wed, 19 Feb 2025 05:05:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7A2044014A; Wed, 19 Feb 2025 05:05:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 97E2328021F for ; Wed, 19 Feb 2025 05:05:06 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 29A531C9809 for ; Wed, 19 Feb 2025 10:05:06 +0000 (UTC) X-FDA: 83136261012.02.3CA81F4 Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) by imf27.hostedemail.com (Postfix) with ESMTP id 41CA24000C for ; Wed, 19 Feb 2025 10:05:02 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=IzZ7p8Sv; spf=pass (imf27.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.113 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=1739959504; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WGGGatMc3XTlrHZosb11mRPJJMxCkTLAw1+W24e+j8M=; b=wgyLqv+kb30sdipJpZKKxXf51OT6ZfYGOscRULk0G1kAeoASNAeNVY1R9ycwlSWOaO7ruX f1KAiYNZIdgkPdnZiFurGZjcar04KFNpT2TmgDk8g2MIM4+/NvfE+de4/DHMEoL5fSqbM2 k8H4AQBGkHj1JfgJZTHRDoZG8I9L7LQ= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=IzZ7p8Sv; spf=pass (imf27.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.113 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=1739959504; a=rsa-sha256; cv=none; b=7D3MEeiD6mfNqBHs1o0zTdJyNTvrqOYak6q6RgAZs9EhyrWmSJiJku3qrcWWxzpBkgkGvL 04NA/Yej5ebmmiC2in+6kejAJ+jQljufdJ2M/VYdosnmZwY6pkjdrzPVeKGcsSe4afEkBq ZiRgJQ+9Zvqc9yBUOfldBqYcese+cVc= DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1739959500; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=WGGGatMc3XTlrHZosb11mRPJJMxCkTLAw1+W24e+j8M=; b=IzZ7p8SvcrqjyYliddPiaoU8XJOSk86WoUxDaYczf+17aDNuxkRGjyWWwBvLAdBOxwqAbnT7tvVxvGoM6LUkCCI3J6v4f+UHuyc3q1M6nLm3IHOXtuPfcnUj9Gl9evgEkufN8I/YsZ4rDIv7WtcvjSkAv/k/nFH1IciznQK0Nt0= Received: from 30.74.144.134(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WPp2srF_1739959498 cluster:ay36) by smtp.aliyun-inc.com; Wed, 19 Feb 2025 18:04:58 +0800 Message-ID: Date: Wed, 19 Feb 2025 18:04:57 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/2] mm/shmem: use xas_try_split() in shmem_split_large_entry() To: Zi Yan , Matthew Wilcox , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: Andrew Morton , Hugh Dickins , Kairui Song , Miaohe Lin , linux-kernel@vger.kernel.org References: <20250218235444.1543173-1-ziy@nvidia.com> <20250218235444.1543173-3-ziy@nvidia.com> From: Baolin Wang In-Reply-To: <20250218235444.1543173-3-ziy@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 41CA24000C X-Stat-Signature: brzb3w4obhhow6korrmqf3js9tci83t6 X-Rspam-User: X-HE-Tag: 1739959502-438679 X-HE-Meta: U2FsdGVkX1+ooe55szvI5D2t3yIb8ifxN7TdX1XUaQr0DfQy/7k6kt3yBqxsxxmQ0FgDut5OFCeCATSSjB++0k8HR1Lf/pcN+tApOcC/fkLReOt9Jrg5M98xh44ctB/AA3ZAPI1IuEEDy1jU8vUCIDslPVWvS1GPXXAdobs0BXzM+xvt3K+5zAWamv9Tw5p3sTEc2xLqbsWJyCGocjidTNT7QWBxXvs0vL6HwjVLS5LGBlaqnwTrFest9e1dv2iNTfHiVY8+EcoyNLldDs9RbtwN1IwlQ/8ywa9IoxsnZrhwEkTh89800+fCdxfoJVUz4ErAscQNXpAzf8qTkeZF76Jnzu2ZirSIaqyw+bs1QvzbVnOUEZbhj99/o9F7BavUa4yLhjtF11+CvdEbxJALxcM9ctvTVmnjGcd9OZctrKYplTLmZJbi48VB+k6QBDcmifB+Eah64z3SuYhkerV6gU4Veq8RuUBMtFsLvivHK/ZQBJXt/J14EIWpwq3K6nlvs/1uFPax7+Zhlg7Ve6mRHrWTTh8avCZYbAQrTjyNmvEl0AjulAVXXs4QlpV3UK2w65YDtnj3Bn0Y8AM5uBhVcvOTeZkeTDD1nBy3t04jqMqUDmtXayzRmbMTBq5LLdO3H4rggdEW08KjyDIQfmH3zoiAgy2nRx/WgxdwzNLvI+UB9UO0ZEsf/bEXdSzeVgHZzCxPGNRiHL09nw/ksi2KYDMUJFKZaY2F/dU2hukWgx5kBJDxB4kaFVyy/n3jfi2WQQVy8mBgLI64qPtS547/olN2Q3V2jpc6nE/D39hH8CxVHwDJbTZDNsRRqHHMt9GlICuR0yfi7p33h8yX1xu1vV6KXd/W73Ox//dS3WLF2H+YeexeM76kCe2vYDRbS8PPCsU3g2PrL4kJ+5tJQIy6oS/FbtV4IGrZmA1HsYhOv/SHpdw28A23TPtz4JYnI21NnqvbBouaFhTFBZqMhE5 8VJbs0jz fSizZijM0Ts7XR3WKAaIDjCl6YlQhIOmo62bpCNnxDSolw2BHUCQIaj+aFnT7/OMgfSTrLDOVb7Ziba1pcVwJ62XnBvgSQPKqNOaaT+UGBUX16E3h+QOlDAHKFB0Riu2yEkyczlfoW9rYGXjMDf8HFXtaONCuaNpVObN4yr8/zeEhT5HSKbimVF6D5Xg+JP9GeY00aIkD11NcWNTKSBQuN6l54hM87yrghnLHvxW13P7h6nCkCRnrzoSO3r9TgsXBGUp0WVtz1pNZCMbt8Lob1T9l/8AvAcPhdI4hDEfiFxSRbYuy1697AJAsPf55YeLBAtM3tlVoJ5bdkJO8YEuHs/KXnoZfd/nr8AsCr/Pe19Yw9CfUzMJGEqfUsA== 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 Zi, Sorry for the late reply due to being busy with other things:) On 2025/2/19 07:54, Zi Yan wrote: > During shmem_split_large_entry(), large swap entries are covering n slots > and an order-0 folio needs to be inserted. > > Instead of splitting all n slots, only the 1 slot covered by the folio > need to be split and the remaining n-1 shadow entries can be retained with > orders ranging from 0 to n-1. This method only requires > (n/XA_CHUNK_SHIFT) new xa_nodes instead of (n % XA_CHUNK_SHIFT) * > (n/XA_CHUNK_SHIFT) new xa_nodes, compared to the original > xas_split_alloc() + xas_split() one. > > For example, to split an order-9 large swap entry (assuming XA_CHUNK_SHIFT > is 6), 1 xa_node is needed instead of 8. > > xas_try_split_min_order() is used to reduce the number of calls to > xas_try_split() during split. For shmem swapin, if we cannot swap in the whole large folio by skipping the swap cache, we will split the large swap entry stored in the shmem mapping into order-0 swap entries, rather than splitting it into other orders of swap entries. This is because the next time we swap in a shmem folio through shmem_swapin_cluster(), it will still be an order 0 folio. Moreover I did a quick test with swapping in order 6 shmem folios, however, my test hung, and the console was continuously filled with the following information. It seems there are some issues with shmem swapin handling. Anyway, I need more time to debug and test. [ 1037.364644] Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF [ 1037.364650] Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF [ 1037.364652] Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF [ 1037.364654] Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF [ 1037.364656] Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF [ 1037.364658] Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF [ 1037.364659] Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF [ 1037.364661] Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF [ 1037.364663] Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF [ 1037.364665] Huh VM_FAULT_OOM leaked out to the #PF handler. Retrying PF [ 1042.368539] pagefault_out_of_memory: 9268696 callbacks suppressed .......