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 AC0E9E71093 for ; Thu, 21 Sep 2023 16:25:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 474FE6B0186; Thu, 21 Sep 2023 12:25:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FE486B01B1; Thu, 21 Sep 2023 12:25:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A03B6B0207; Thu, 21 Sep 2023 12:25:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1A45C6B0186 for ; Thu, 21 Sep 2023 12:25:49 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D9759C0385 for ; Thu, 21 Sep 2023 16:25:48 +0000 (UTC) X-FDA: 81261130776.26.0732F0C Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf11.hostedemail.com (Postfix) with ESMTP id 17A5740019 for ; Thu, 21 Sep 2023 16:25:46 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695313547; 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; bh=zSC1wSLCtCSgc8VWe2aXoYvfW28VD0xxRoxySeG8aDE=; b=ZdqBcWQ0mCxhrHL36BVfvnu+fC/+/ZX5w/c42+g4sD/ogAGZMDmzoKPPu67MjKndehS2x7 jOl60OMFaO5wc8Z8TMOQJOddpu65w0+67pp7P5Hj6B55KsJNAGuBB0XuQLQX3X5I6oOl6t 0fwgmED58mE2Lk1kfDIT/bC956bji3M= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695313547; a=rsa-sha256; cv=none; b=gABPcZas+1eABb2TsEqVGlh9x0CG7btwwKjK2Z9zOUobVbr6TvKXbA9G4xb7stXS+QWmbC PVERzCpLoIB9sL4um33pM5V5eyPx3DR6RrnAGAn+f7unurMwOLfPZRPjcqIDLP/XkQV5/1 62ePtcMio6bnaLM9x78c13+Ek9WbZd4= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 85A24176A; Thu, 21 Sep 2023 09:26:23 -0700 (PDT) Received: from [10.1.34.154] (XHFQ2J9959.cambridge.arm.com [10.1.34.154]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 408773F59C; Thu, 21 Sep 2023 09:25:45 -0700 (PDT) Message-ID: <7aee2aeb-acb2-4fe3-90b5-3dd43ee855c2@arm.com> Date: Thu, 21 Sep 2023 17:25:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mm: hugetlb: kill set_huge_swap_pte_at() Content-Language: en-GB To: Qi Zheng , mike.kravetz@oracle.com, songmuchun@bytedance.com, akpm@linux-foundation.org, catalin.marinas@arm.com, will@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20220626145717.53572-1-zhengqi.arch@bytedance.com> From: Ryan Roberts In-Reply-To: <20220626145717.53572-1-zhengqi.arch@bytedance.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 17A5740019 X-Rspam-User: X-Stat-Signature: 1or7swryhdfqzf8renw117956f7m31r6 X-Rspamd-Server: rspam03 X-HE-Tag: 1695313546-723039 X-HE-Meta: U2FsdGVkX19E3kyCNmePJK+KrH/8ot8EkqnXd6H1wlyLcZB0KzBUF2oFfkeZwopu/eerEfmtr/mJTmoZVXegy+54p9EAfSLFUjYiUOQ4x42c16J88B9whlAWI+1vcmjthxxurDyhHS22zdKtaLy7ZPbGImbaosg56lPl3IyicVbv1TzKdxeNYV7NrBtnAgCLT1p0ms7mKGRgY+YWHQrXainYYlm9GznboashyQx9sTgISGdH1f7VTjZwNDKnLH1E37d35o1FUC2JvTnAJGloekyYQ4NxXhjPlGUZTlPgIg8k3mJBRkTEbr9nFCGL9Yg76ZJL048BewvlI1NDTDch6xsSV555Fp+pujq+y0NsOl6rI9h3xCKlzzZuyFQClmfP8Blt11DKJkoqcTfVAb4WQ2fA1j+5PkohttYPZ4ve3dVFC3Iajzetz26uv9BtgUEe07SKj/5VjSpZxFMPBdfXyGs8g7xTNAsFd8rJO0Z4NZAcj0YQcNNb1UGeWxno6WhaYMKCAjpeWBswaObe4W8IgG2tdCZQnhB97m2ddL/k/KDtIVewlCtWeimzd4bCopUYKNFd9CyadUWM3povGQhktVpCQuwYosy09jD6x2u78Avd/iXsvQvUn4PDL3AprzWjU0457ehVe9Y/ZGqzlsJRoEjCVqyiXgoZ01qN4yckVviRO+2iH5i2hZmbwzddkev88+HVEjAcRjb0h80wzlgktJPb/1kWLzBjgAsSeQAfUx7BYtxuU0GHQIrTePBa57pTi7l4eulxo3McVuxNgORtZq66nkkUrpznyUDf98RlOe3FNIVX8cKhwknVpDzvBBW1S0RRiyexgaOAouJFrzsD/OR3OaqIeh/lXKTebyNfsCZLB+Zr8cOY3bO1CYHcurZnRdV2NJgjWDf0o5OroDrvFbLRVuUP+D1XNi/NnXDLOuJcaAjw8CMLAeY+iRdpYt4pa+PA1Ws4JhJ2AZmCAsP dduL2npF v/cOfA90y81vm8ofVr3iWJq9Nsxj9tylPORKmEYWedfB1P6Ds8uQQdxUbkW1Hin3/SREQF38qmlB18//vMhrb/kVex9IzorrH6gB8D5YKxtQLEHgD4+xJhc6DwqooYmvbSycNw3u0pqZ8bwrLVk8Pv1FXUhZl+3R7XTTcnMB030AO4oK1IKLnyI8Fg0o0vbC5/Pks/v1HH2FDVbDQwO0QTLHFpaEZxgkC8JicqQn8gUqTaidsCzMSwvwI0ucWs7REC0wIlzxNM9Ig6rRST4u2PGkggripAmm/bI9pmdy2ktnx8fr9AyH88ur4AvLWMVhN7y97W+vDT6IALx0PFb00U0EgwZn+zfsvJDZZD+EEdF7udtd2+kjfBu39MQ== 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: On 26/06/2022 15:57, Qi Zheng wrote: > The commit e5251fd43007 ("mm/hugetlb: introduce set_huge_swap_pte_at() > helper") add set_huge_swap_pte_at() to handle swap entries on > architectures that support hugepages consisting of contiguous ptes. > And currently the set_huge_swap_pte_at() is only overridden by arm64. > > The set_huge_swap_pte_at() provide a sz parameter to help determine > the number of entries to be updated. But in fact, all hugetlb swap > entries contain pfn information, so we can find the corresponding > folio through the pfn recorded in the swap entry, then the folio_size() > is the number of entries that need to be updated. > > And considering that users will easily cause bugs by ignoring the > difference between set_huge_swap_pte_at() and set_huge_pte_at(). > Let's handle swap entries in set_huge_pte_at() and remove the > set_huge_swap_pte_at(), then we can call set_huge_pte_at() > anywhere, which simplifies our coding. > > Signed-off-by: Qi Zheng Hi, FYI, I discovered a bug in v6.6-rc1 that causes a kernel panic, which I believe is caused by this change. I've posted a fix along with a detailed explanation at [1]. [1] https://lore.kernel.org/linux-arm-kernel/20230921162007.1630149-1-ryan.roberts@arm.com/ Thanks, Ryan