From patchwork Tue Apr 9 11:18:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13622300 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 B0666CD1284 for ; Tue, 9 Apr 2024 11:18:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 466316B0095; Tue, 9 Apr 2024 07:18:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4162B6B0096; Tue, 9 Apr 2024 07:18:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 305456B0098; Tue, 9 Apr 2024 07:18:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 10C0C6B0095 for ; Tue, 9 Apr 2024 07:18:55 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C544C80390 for ; Tue, 9 Apr 2024 11:18:54 +0000 (UTC) X-FDA: 81989746188.11.5FA0611 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf08.hostedemail.com (Postfix) with ESMTP id 3B74016001B for ; Tue, 9 Apr 2024 11:18:52 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712661532; 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; bh=nQ8adHKQiJgCOXWYUbj3yazCyZI66wKCyk5twKRo3Mo=; b=uNdq2aN39oeynSKvvd4i3dhlJ2TtagmOG7fdHS1Y3D4885smqkv24vSkER4zbfIPxgNNC3 6JP6EzF34bVg3zGxFZCf9Mf+aeHEQEMCgju6BhmYqVRyyajyeHz0hE83KC8dSfXWpZDmOv B0n0138t1XzyjYdTbXtrTYaLck2N0Ck= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712661532; a=rsa-sha256; cv=none; b=CWrR35DyXk0SEInoF8yWSMdIl2F9z5Iz9mYC2B+Kzu/ncTCbr3aHr6HJB4cR4qn7THuX52 Jk986OpIX20KoX27BZrRB3ots6B9tumxxAXhd4FtItbJNPfnTdllQXpuwufsAcaheCo8// FgTVpRcaXB8o0UV5zXnXq0aP7hBCBNA= 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 9940D1007; Tue, 9 Apr 2024 04:19:21 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 87B523F766; Tue, 9 Apr 2024 04:18:49 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , David Hildenbrand , Matthew Wilcox , Huang Ying , Gao Xiang , Yu Zhao , Yang Shi , Michal Hocko , Kefeng Wang , Barry Song <21cnbao@gmail.com>, Chris Li , Lance Yang Cc: Ryan Roberts , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] FIXUP: mm: swap: free_swap_and_cache_nr() as batched free_swap_and_cache() Date: Tue, 9 Apr 2024 12:18:40 +0100 Message-Id: <20240409111840.3173122-1-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240408183946.2991168-3-ryan.roberts@arm.com> References: <20240408183946.2991168-3-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 3B74016001B X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: gc6wxts6cz348ocgj5ezuish8adwne6g X-HE-Tag: 1712661532-103920 X-HE-Meta: U2FsdGVkX1+h6rpqB6YfSaabF9Jf0nLZ4CcpcWKzSV8VKcgPbXTG3YVdboYQ4dYZ0pUuxBq2hCpAQjyBas2mQhuE3AZSf97c+CzFTUXmbgOvygfldSublVn8g7KYstTa+lxbKIe5Igx0+zux8ikNKaEz6E6YDYFQaNKUFnM+fFcOYT5dc0viTGV8h88YJ4FavMsDZ37dIZow4y5t5W0bc90gQU4vrN1UsGCa/tjvvt5ZoFd5GstIgD1c0w2ccojkli7rKIawZ7ol0pVNoOL6J1X1tq3ftfZ+gbiNSGJotTFlUnNOFr1BUkG1Mom5RTu6lV6Olr0kzucyQ1VjUeYD5+tFPes1gvfVfDcZ636VPJzn4KFw+9/E/AcR06SIy2yZVEJ8XLMdKuvzi3rr0jlmEMEanX+wYceGPEUbpcofYoqAQSTR5pMGssSpO+gzAL15fZzL7tVD0S1WVPh9+xq/DOTEaxeiIAk6QXXhcMVXNa0lsE9pk1Hlf9e+6/ck6cTEwSf0yWs4CwjatA77gKx9EN2qnZCPsl6bw8OVHLmrEnhgb4WvIWO5i8Q1npnWhrMD2f8CQ99ZOijjr0p+pZvLMoAvLwURdGvvodzKR5YAYqDmUf7SYUSCj+ZXg0BXbKPTWBufdTKIhOO5emkb6txvNzOBoHPuNGQeOp9T8HvLHHwngc5j/hNTUMlaiOF3XaG1M7GS/o9fLbNCIcozMt/vF7qjz/mFwbM76avE7z7aeeXcVecNDV/ZVx9jJ5zpEno1z+Ac7/VvOVbsoOAD3F7+I20HU8ZbuRYHLJrAoniVpuhJPXHlcO0yIm8AgfYmwIaaDBecR+HoJ/CJ/xw0eTkq7jAjhlcJGOtNMzPRiX7mF1muHunP6zllGJ4h8xuMqit73d2ePWOEfcofYQvngP2yatMIFCeiLPh3Ri8ezYry9UvFg3MUqkWvRZSTXOYZvae5NFGz5726vTXl7JAl5aH v7otPaHQ aUtkRJBkOzlBVynoDwjKL8R/ITKjFr3t9YLnI8M2xywaWeUrwdTZ2Njbmtv/TlaaJOxibfnavrzf8/CEVwvwQ3KtJM/HOdboho4yBiEGdnBz6xEGDFYnkr9WA2/EXh4pyad/Di/K/isYMIrCRtxLt7yJ77xTKy0I+jOXeUsO1WuDXK5r9wE6yCBeshb8QE6lSSpU6QVswrG8bILHvlvHphZReAnbrO9dqZMNgsJA+D3jiOofXmGNbJ8E8Gxk4nrhbtvPTHXdMuZme1dn7IVR0/OAd/XL/97ZCxvHC 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 Andrew, Could you please squash this into commit "mm: swap: free_swap_and_cache_nr() as batched free_swap_and_cache()", which is already in mm-unstable? It fixes a build warning on parisc [1] due to their implementation of __swp_entry_to_pte() not correctly putting the macro args in parenthisis. But it turns out that a bunch of other arches are also faulty in this regard. I'm also adding an extra statement to the documentation for pte_next_swp_offset() as suggested by David. [1] https://lore.kernel.org/all/202404091749.ScNPJ8j4-lkp@intel.com/ Thanks, Ryan Signed-off-by: Ryan Roberts --- mm/internal.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/mm/internal.h b/mm/internal.h index 9d3250b4a08a..22152e0c8494 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -202,7 +202,8 @@ static inline int folio_pte_batch(struct folio *folio, unsigned long addr, /** * pte_next_swp_offset - Increment the swap entry offset field of a swap pte. - * @pte: The initial pte state; is_swap_pte(pte) must be true. + * @pte: The initial pte state; is_swap_pte(pte) must be true and + * non_swap_entry() must be false. * * Increments the swap offset, while maintaining all other fields, including * swap type, and any swp pte bits. The resulting pte is returned. @@ -211,7 +212,7 @@ static inline pte_t pte_next_swp_offset(pte_t pte) { swp_entry_t entry = pte_to_swp_entry(pte); pte_t new = __swp_entry_to_pte(__swp_entry(swp_type(entry), - swp_offset(entry) + 1)); + (swp_offset(entry) + 1))); if (pte_swp_soft_dirty(pte)) new = pte_swp_mksoft_dirty(new);