From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87628285C89 for ; Fri, 26 Dec 2025 08:40:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.112 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766738447; cv=none; b=J3tslPE1wupst+T9Wh2OHHzDO7kYV6vndZI3IbdUgKC7DaUk+hJFO58DQwrduEht5LGYsIcTjwBsTZK8vWk/qrNzDusFRYPN2VgoHSFHptzSOZw3iVN1w8rUyHhLzKiOY00QPiPvD9XdgUjRr7/qRl79TzPbaygzERmjz8zEHDM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766738447; c=relaxed/simple; bh=nJQwZ+ILVrIZw+Ic9aB4zXuPVLv8APMnaGmZHNA1JjQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=GHbNEDEvKqm1xfBd5Gwygru1fnt4pVVENEydCdcM3wD8acdc9+pVo/Pvl5j7Rm/MPvBN8y0BKibEPdbtzkbrqzOP6h9ihPe3eskQkwPHAI5AWyBTwp41lo0q0VJLH7pWzwzZntX7Yn36jRgptFPq7FKhpofUeeW9tSJJB7Wn0QM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=Df5ZsSSQ; arc=none smtp.client-ip=115.124.30.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="Df5ZsSSQ" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1766738432; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=yfHDUPHLpb//CYvTTsSDlTKvWibGdWvqGHEMZe8sFu8=; b=Df5ZsSSQoMI56ae9lFt4TnQ1Kv7bzapIu1MCqaMtuM0GPKJ3HeT8lAWsO3vFcmmO+w7KVvteOkF5KUxyD1ajc5egA78ywCEPq58wpsiaita0fzPbXAfe9QBtHaiGKaz8x2rj4erypaTj6mKNpshi07/sNQg7urzAECYUVd/svtw= Received: from 30.74.129.66(mailfrom:tongweilin@linux.alibaba.com fp:SMTPD_---0Wvh15pX_1766738431 cluster:ay36) by smtp.aliyun-inc.com; Fri, 26 Dec 2025 16:40:32 +0800 Message-ID: Date: Fri, 26 Dec 2025 16:40:31 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH] arm64: Kconfig: enable ARCH_WANTS_THP_SWAP for all pagesizes To: Barry Song <21cnbao@gmail.com> Cc: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Morton , David Hildenbrand , linux-mm@kvack.org, baolin.wang@linux.alibaba.com References: <20251226063759.4020782-2-tongweilin@linux.alibaba.com> <915dc88b-9131-4520-a2f2-facadc887bbd@linux.alibaba.com> Content-Language: en-US From: Weilin Tong In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 在 2025/12/26 16:31, Barry Song 写道: > On Fri, Dec 26, 2025 at 9:18 PM Weilin Tong > wrote: >> >> 在 2025/12/26 14:52, Barry Song 写道: >> >> On Fri, Dec 26, 2025 at 7:39 PM Weilin Tong >> wrote: >> >> Currently, ARCH_WANTS_THP_SWAP was limited to 4K page size ARM64 kernels, but >> large folios requiring swapping also exist in other page size configurations >> (e.g. 64K). Without this config, large folios in these kernels cannot be swapped >> out. >> >> Here we enable ARCH_WANTS_THP_SWAP for all ARM64 page sizes. >> >> I no longer recall why this was not enabled for sizes other than >> 4 KB in commit d0637c505f8a ("arm64: enable THP_SWAP for arm64"), but >> it appears to be fine, and the swap cluster size should also be >> more friendly to PMD alignment. >> >> >> #ifdef CONFIG_THP_SWAP >> #define SWAPFILE_CLUSTER HPAGE_PMD_NR >> #define swap_entry_order(order) (order) >> #else >> #define SWAPFILE_CLUSTER 256 >> #define swap_entry_order(order) 0 >> #endif >> >> >> Thank you very much for taking the time to review this patch during the holiday. Wishing you a happy holiday as well! >> >> I appreciate you pointing out this optimization. We initially noticed the issue because, on ARM64 kernels with 64K page size, if large folios are used in shmem, they cannot be swapped out as a whole during shmem_writeout() due to the config limitation, >> and are forced to split instead—which is something we wanted to avoid. >> >> It seems that this change will help enable better swap operations for large folios. Thank you again for your feedback! > Right, I believe this is the correct direction. Just double-check that > the MTE-related functionality works. Take a look at commit > f238b8c33c6738 ("arm64: mm: swap: support THP_SWAP on hardware with MTE"). Thanks, I will take a look.