From patchwork Thu Dec 8 18:02:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13068642 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 81089C001B2 for ; Thu, 8 Dec 2022 18:03:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A0508E0003; Thu, 8 Dec 2022 13:03:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 029C38E0001; Thu, 8 Dec 2022 13:03:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E327C8E0003; Thu, 8 Dec 2022 13:03:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CF7468E0001 for ; Thu, 8 Dec 2022 13:03:15 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 9758D1C68C3 for ; Thu, 8 Dec 2022 18:03:15 +0000 (UTC) X-FDA: 80219910750.27.C3C3C51 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by imf01.hostedemail.com (Postfix) with ESMTP id 0193340033 for ; Thu, 8 Dec 2022 18:03:11 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=a7zzH5IV; spf=pass (imf01.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.216.43 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670522592; h=from:from:sender:reply-to: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:references:dkim-signature; bh=ljb95iV2S47yFqe7M/P8twoED+tVhYFBm2hBkjjyeIA=; b=1usX7p6blGl/JfcpK8bcYmJ6Av5D3Azh32UzfjyGUzobDLnye3tjdgBSaC092Jsm1Bu9uy 9k6ixl9V2DYmQOu+GqBTAlSDDMhnRgJskaX9mcnyicbarecSe0BdYqtCUoaTBIMB4s9WtA VJANPaK554nFl6xH/ARvASqQQQ/CVOs= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=a7zzH5IV; spf=pass (imf01.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.216.43 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670522592; a=rsa-sha256; cv=none; b=zLozBg4t1JtdpGEZiWRMG0pb3X/TvMZC0f7kaO/VvMIN9s0upiy9260rZr2zUuM35CXHJE 5YRyR4mivSv0NI8L2y+yR4guO2gO+AE4ABaLOJKLtFLaPSjkPOOPwSsMsHIs8okn9AJqSk DHez9kbBSQDwUl+UVWuhLJ9s4LWhMnc= Received: by mail-pj1-f43.google.com with SMTP id o12so2306608pjo.4 for ; Thu, 08 Dec 2022 10:03:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=ljb95iV2S47yFqe7M/P8twoED+tVhYFBm2hBkjjyeIA=; b=a7zzH5IVhSlqUV1f3wxFN1w4gxYVvptThMs+6ClgGLMen6dx4HjWmNYpT6Na1cVdt8 +G94ov1eGOViFGejZ9Ck6xLXODIXAGZ2oH5LiAUk3j2POI7WzfkgZrqv03GO7VvmBqtc vYYtc2MConieAtU21n+Ce0FhJIyw+MiITecxbankO3UNZIp+qekQnSrqNSyq6N+CwUO5 YcXuub28iQZ+RKoGAFz7RYyi8kp3axpTixnhspQF2x35B9nTu1mvAkVbvKCUn6Eaxr+4 SM6JZ2+BDIgDaL+UJkkcjhU+xQKFCXdv6xhqbUU9fxcWSRFXtuhhVyWpbTq76UCxcTwZ Oveg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ljb95iV2S47yFqe7M/P8twoED+tVhYFBm2hBkjjyeIA=; b=dkOfliGwh5eZLtIJi77+P9Whhb26qPQfdzrMb2wn7ZiVGI8Q6RZQ6P1wZxiFGF//uW 6AL/OJtXrEV0q+NDteWBSsrOMDBcEfcR+q+GU9Umf2V0v/oWR2iuy5+yUcApnsXivskJ xpCMK5ajj4JQqV8AVdprLhVB0M8WT0zSPWxy29hW8NDamjdJ5T4vOoyhg+x3SiOtVoRQ O4Rb7SofPMPayQqmAviNOqM0iR2UiFJ4IjppYk7yk5JPn8f/dM24ojU9IUaZS6RCoNLK 34R75Hg5W3YqnpaRyiHtANcteae1QYk5Uh+THDgQzZ2//k1j/oQlWx87dyi3Q6hUQXI6 U0Mg== X-Gm-Message-State: ANoB5pnXMyvu8d0YTSGf8K6wILP+UoejJBVGft7gE0hZ75RPsESW1Th6 smLSiMQBe8n5pEtjTVX/Ye385LBdTGZPrA== X-Google-Smtp-Source: AA0mqf6SSYH4e9jGauKo9F/kLuRDw93dqOivHJLactz+eb7+Sw1nCsMIeg8/Vyv9VX8JNRe/PtB3fQ== X-Received: by 2002:a05:6a21:1690:b0:a7:99c4:80ec with SMTP id np16-20020a056a21169000b000a799c480ecmr3696639pzb.20.1670522590145; Thu, 08 Dec 2022 10:03:10 -0800 (PST) Received: from localhost.localdomain ([198.13.51.166]) by smtp.gmail.com with ESMTPSA id x23-20020a63db57000000b004785e505bcdsm13377909pgi.51.2022.12.08.10.03.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 08 Dec 2022 10:03:09 -0800 (PST) From: Kairui Song To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Andrew Morton , Miaohe Lin , David Hildenbrand , "Huang, Ying" , Hugh Dickins , Kairui Song Subject: [PATCH 0/5] Clean up and fixes for swap Date: Fri, 9 Dec 2022 02:02:04 +0800 Message-Id: <20221208180209.50845-1-ryncsn@gmail.com> X-Mailer: git-send-email 2.35.2 Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 0193340033 X-Stat-Signature: zscytn7p6m86qqurxrpgyw1i9orie7z9 X-Rspam-User: X-HE-Tag: 1670522591-195652 X-HE-Meta: U2FsdGVkX1+8iGpyFOgvtCD2DZNFCksTTRcy5K0a68Kijh7CGUXa38BLz5NWpU5O/z1LFIOQvrNoqYK9EWyD5WsN4q1bHq58oNJqcIYTEPhK7h0XV6tqJJwvc9i9Us6/5HusgMBvusPWtFVyMg2pyYPQI1uGhcuQPt2cTP/V78dZPZ5YHyjQ/NW8BSFtY59NUdO/XrrxQRMGqX4HGBRSWGv6Ia3nbYkxWZNaWbVs6H7TPFa+eC+IVKHLXWQLil7OCPLAeqsqzSJLKeqeP6EjaEKq8ao9Y4Zz1d5PhPEp9ctrksXg1aslQqXjwAgioUIhbjiUsSJT/yf7V03O6rc6ag1cQZd32HLq3PeFM7yR6r4TXKIpd/GaEQ/pBFKkAB7U8pisALsxUFaRZPDrr33Oj9QrlHjRSL0FeokjBlOahsEhcM0xdwwcrqtZoXCnU3pK+RXojfDq+rV8f0XSocQTDwzd9KYdyXIEw95pvxUQErFSK644lklN+8wtbq121artK475fho9HzdBmzlXNcvInc8q7ID0awXgHp0VZBZyv/AhhCwHKOP2bu9BpYhs5i8VO9uTLL6ebLthG8ZY0AfJhZ38n1aBNl2Wux38s0d8frsN8NQRkcLZNgS2K9FZzRoryZPsF5aseF1gimH2HuJhNgrLwRDA+uXRa9fHk9JdJOr1CQUYjf8BXRegZS4Ul0fpjKuhjLj7hdd8qxk7/uZ6cu8dNvJV/kn9CXGttzxh5aPMKiMipX/RBuA7dGxrwUL56/5LK2byTqhb+JdIjhx4MjKRCMq5JEWFKzBzyQgn6UHzml1R9mFxxifEoL9qwrzLII4evhBmlNFgHZhZp8hILSC2RHR6SAQ6pEVRKfCJNB+kR5nM42FX4rrKf+XuYEC7VJSwLPGwqVoBpLA2OykAiZ+PtQAk3pcPZ9hMzaSlah/0I8JCqfLPQ+znfPTzUkoxfzUELLpMujOQFqR7rmp dy/tcI5w LHP+Zc4V+2O+MA+qwr9p6T1yO8chgkxtWF8+DnxTrOyTdWx/vvd8QaxIvC5JeFrf5PVKX69W3CdbPuvtmWpeFrpiINTe8X5z+p4NA8TC5P5Bauxl+YKh8rnABrn/3303tXbKwfBqZmaV6KrKv2tEoHBEFJjryOKVO5NSl54S/fz5vTwP1u0AFKNMysZ8U0PlUIGaKOHVnlcLevshskFzKV4JXX3GbdXetrNZiX0k+rQe/RSzlOsCJOnP9RXVE4GcG4Cs7XMF8bNZ1qQQpMBiX7bHXDw== 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: From: Kairui Song This series cleanup some code path, saves a few cycles and reduce the object size by a bit, also fixes some rare race issue of statistics. Kairui Song (5): swapfile: get rid of volatile and avoid redundant read swap: avoid a redundant pte map if ra window is 1 swap: fold swap_ra_clamp_pfn into swap_ra_info swap: remove the swap lock in swap_cache_get_folio swap: avoid ra statistic lost when swapin races mm/shmem.c | 8 +++++- mm/swap_state.c | 66 +++++++++++++++++++------------------------------ mm/swapfile.c | 7 +++--- 3 files changed, 36 insertions(+), 45 deletions(-)