From patchwork Tue Jul 30 07:13:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 13746776 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 63314C3DA61 for ; Tue, 30 Jul 2024 07:14:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C46EA6B0088; Tue, 30 Jul 2024 03:14:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF7686B0089; Tue, 30 Jul 2024 03:14:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A982F6B008A; Tue, 30 Jul 2024 03:14:10 -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 8C4B76B0088 for ; Tue, 30 Jul 2024 03:14:10 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D98B9C0153 for ; Tue, 30 Jul 2024 07:14:09 +0000 (UTC) X-FDA: 82395555018.26.664B50C Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by imf28.hostedemail.com (Postfix) with ESMTP id 2124FC001A for ; Tue, 30 Jul 2024 07:14:07 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cB1fVY7f; spf=pass (imf28.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.215.175 as permitted sender) smtp.mailfrom=21cnbao@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=1722323593; 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:references:dkim-signature; bh=rpVSJhXd5VbYI3+8Mr7AbFAtjp887GR7s1Le6UFvvB0=; b=ZAQ0ks//XlRNJWj+IWAote/M2NnF33MMziKEFqN8NXMGkNsNdXS7edbUOORID1nBfSyFjL gEGyIZDuy3AQshxyyJg0hyIXevumxiUiydU/wFjQcpfCpxbVS9SpKufC7COpa064WG8Bnr Rg/jwco/deUsM1n4s2FmoYYBNg8EJQs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722323593; a=rsa-sha256; cv=none; b=f7TjW10s5dEnE1eFS44OMtuMjIvdLiZONN8Jv9whxutmzOYI37CoCwuFekOgsZTPtod4/Z nAiJtuTmRQdJlQlua0xZBmJc8Rw8AgAIceHd42BoS8iEDiWCSCmoJvkGh1Z2WKFWuFy8Kn xEvkYgNT6iFwIT/AMASHYjRDSHB9TgM= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cB1fVY7f; spf=pass (imf28.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.215.175 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-7a18ba4143bso2774899a12.2 for ; Tue, 30 Jul 2024 00:14:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722323647; x=1722928447; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=rpVSJhXd5VbYI3+8Mr7AbFAtjp887GR7s1Le6UFvvB0=; b=cB1fVY7fesPdkNnV0ekQoOgXa6YwgPjdhnO+I6JXVWT8fcvLVUDTbLY+hjBL5PFj9T Uyc6HQztSMAjfGnGUjMu1udnm6Ilnr00+Q6npf5ouS5Rg5ye93FVJKNnuoEvmu/iMv1h +JJl8OEujAsc6XhHntcC51j0UNMB6ytm/eyIQqtaK2aWFfFILP6fOydeDOmWQZkSZZQe cOPvAIr2zq9ZGlY2Zg7WW/jcWA4xMKe4ZDcKOpxksJaE5iaVM+uOzEuOkNv505Pp1llj 8uhjOLs86WNzPjrOiuUhTMSE51Ijw1uFZWf5/SfRrVG5n6aascwotftBq7otW2NYEk9m SjbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722323647; x=1722928447; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rpVSJhXd5VbYI3+8Mr7AbFAtjp887GR7s1Le6UFvvB0=; b=eOX9RlSebKWVS1un5ge3TnBwxlLcPX5MWxTOBurGj/QhFARqzej+BmlfuMMqvMqRjF YWxFOdWdz8I4Ulcy7NDhcp8vI4YonVDoSBIFRLBdhgD5MRpeoUHArKSfgJ/mWr7/FjLV IGgEXDo8UVcoZ3LXUTvFHwsp1a1mIf2CsqDYIl/Zg/FwKbIqAo+vgJQgOozaArdwJXeQ TXptIm5Hf9ZO1OP8lv8tkQiAHm4FqgynynuPrrlFNLtbZLtmAI/7ow4WpE0JlL6eORxI EE6tAtyzrG+3vP3OtP0+LNApmOU5CnWbWhUR9y3z6hQLV8gTxvZOTATda8Gq8mmD2u4K lFvQ== X-Forwarded-Encrypted: i=1; AJvYcCVUGXVDrNnK7EUAkZvU+t4BGgRoSQXI/5oaMiWEOPPmMxykKbOjDJFh7ut1k3w3nw4lCtvnYPtSihYSgpszQhfKeHw= X-Gm-Message-State: AOJu0Ywlt7gkyySbg3ozbmyRTM1KYyZssr+uTFCtK6dvtxU+j5XRguMG THDH5Es1VDh4zjFg8WxRXajTttvGyg67PgK5QeK6CKuaK6j/wBiv X-Google-Smtp-Source: AGHT+IFepfWS3ibzltNNj2a4WSvl9NHxlJg7gDdRNuJYedVJOZzIUZaFbh3pgAoBt1vDAYsgYAcizA== X-Received: by 2002:a17:90a:fc98:b0:2cd:2f63:a429 with SMTP id 98e67ed59e1d1-2cf7e726968mr8043875a91.35.1722323646682; Tue, 30 Jul 2024 00:14:06 -0700 (PDT) Received: from localhost.localdomain ([2407:7000:8942:5500:aaa1:59ff:fe57:eb97]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2cf28de71a1sm9736452a91.41.2024.07.30.00.13.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 00:14:06 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: baolin.wang@linux.alibaba.com, chrisl@kernel.org, david@redhat.com, hannes@cmpxchg.org, hughd@google.com, kaleshsingh@google.com, kasong@tencent.com, linux-kernel@vger.kernel.org, mhocko@suse.com, minchan@kernel.org, nphamcs@gmail.com, ryan.roberts@arm.com, senozhatsky@chromium.org, shakeel.butt@linux.dev, shy828301@gmail.com, surenb@google.com, v-songbaohua@oppo.com, willy@infradead.org, xiang@kernel.org, ying.huang@intel.com, yosryahmed@google.com Subject: [PATCH 0/1] mm: swap: add nr argument in swapcache_prepare() and swapcache_clear() Date: Tue, 30 Jul 2024 19:13:38 +1200 Message-Id: <20240730071339.107447-1-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 2124FC001A X-Stat-Signature: 1qs59ww1x4a8xhrozzyxk484safzo1zb X-HE-Tag: 1722323647-780938 X-HE-Meta: U2FsdGVkX18MHS50pGzq4tEUEjoo6LMOMjbEFpod80/XKCZMbV/SfdyrjC4NY7haQ04EA4Fae+EJEPs2o/yCbfX6k2+Q/WFyOEAGSIq1uG7R9xXfizSF+dJ8djaHecygXCrT9z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gaCQMH4D9BmC92ZHpSAE3eDweqt3+7va+49Ddx1cjXX8tH75HD4ZK9qLPyJh9VRxfrJ5V6bMYSgk+I6kuEVy+zjyFuQGlWr8OC2WfY2LCoqVes5OrD1MZKMxYT3OvvXLIMYlHyDeJzihG8UAtoASJzs5Gy1tdXdJevEsQ5YusC8INrrZFowPFeGZ+vWbXOqM4CATRHl2QcJxedZsb9yPDhDRi+vYYB+x9/OHwRg0B3KqO9z9QJOgnDJq1CnCsCSjLFpqOF8t1zjkcpnzKflk2QOL50mul0L4dfHxxPAiJgQEMAkMbXYZ3xI/mFbTl7z7pI2sZ3MI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000607, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Barry Song Per Baolin's request[1], shmem also depends on this patch. So I am separating it from mTHP swap-in series[2] so that it can be pulled by Andrew earlier. Differences with the version in the original series[2] * collect Baolin's reviewed-by tag, thanks! * add nr argument rather than instroduce new swapcache_prepare_nr() and swapcache_clear_nr() according to Willy's comment, thanks! [1] https://lore.kernel.org/all/c2122229-3710-4e16-8932-303da0644a6a@linux.alibaba.com/ [2] https://lore.kernel.org/all/20240726094618.401593-1-21cnbao@gmail.com/ Barry Song (1): mm: swap: add nr argument in swapcache_prepare and swapcache_clear to support large folios include/linux/swap.h | 4 +- mm/memory.c | 6 +-- mm/swap.h | 5 ++- mm/swap_state.c | 2 +- mm/swapfile.c | 101 +++++++++++++++++++++++++------------------ 5 files changed, 68 insertions(+), 50 deletions(-)