From patchwork Tue Jun 18 06:54:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13701843 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 41788C27C4F for ; Tue, 18 Jun 2024 06:55:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 91B8A6B0159; Tue, 18 Jun 2024 02:54:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8CBEE8D0001; Tue, 18 Jun 2024 02:54:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F3F36B015B; Tue, 18 Jun 2024 02:54:41 -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 4A56F6B0157 for ; Tue, 18 Jun 2024 02:54:41 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 07BD71604EC for ; Tue, 18 Jun 2024 06:54:41 +0000 (UTC) X-FDA: 82243096362.01.B9856AB Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) by imf29.hostedemail.com (Postfix) with ESMTP id 0BA58120005 for ; Tue, 18 Jun 2024 06:54:38 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=gyAs4VwM; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf29.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.132 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718693674; a=rsa-sha256; cv=none; b=DFQxAVGMr8hN9ptIaUseSZu1K2dBftER3oawoXDD17oPpFetFyaSBp3vLjKRy1w4o1Ix6/ SioOqpqa4IBF7fjw+Jb92a+UoFMruSM8ZVQpd6/9XLVbVM1onOtJHEXVM0AP7gFvcXCfyI OnKr+4FsyhNiJUiMMu2KOnFx+k+tmjs= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=gyAs4VwM; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf29.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.132 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718693674; 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:dkim-signature; bh=BtIWGiPeiPtgyrkhSZFohxCr8LroRfij9iZfhgtdvvw=; b=fY7D21pov0MxVL2auQPelVwcqHPLomDKfIz4OzNsABIvwk3OpkRrvcU1yHxqZnM/PlMLTx xXfMTgiklCrxEPMmccugOeNLkDe/GejBq40sX51ZLCm/35FJk/fFU6Iq++f2cWvsw2HcSb EHKXPemQYLHqPzwhV8yzWLGt0tB6MzA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1718693676; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=BtIWGiPeiPtgyrkhSZFohxCr8LroRfij9iZfhgtdvvw=; b=gyAs4VwMbBvh5u3NgjIpZNLJC1Fo5FHERWRYo8JvDldXw1EP3eGTh9FovWARVvEbQpHsQLa54S8j6Bixdq2yockcs6r3ze1ZfxqmXGQ/p6erAZGqZ4tC6ECuWS/YilUVtYTG72BbDWGCdN6CyXf71gOOPFc4GDwxgqSyBsSN+No= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033068173054;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---0W8jFFMY_1718693675; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W8jFFMY_1718693675) by smtp.aliyun-inc.com; Tue, 18 Jun 2024 14:54:35 +0800 From: Baolin Wang To: akpm@linux-foundation.org, hughd@google.com Cc: willy@infradead.org, david@redhat.com, wangkefeng.wang@huawei.com, chrisl@kernel.org, ying.huang@intel.com, 21cnbao@gmail.com, ryan.roberts@arm.com, shy828301@gmail.com, ziy@nvidia.com, ioworker0@gmail.com, da.gomez@samsung.com, p.raghav@samsung.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 8/9] mm: shmem: drop folio reference count using 'nr_pages' in shmem_delete_from_page_cache() Date: Tue, 18 Jun 2024 14:54:20 +0800 Message-Id: X-Mailer: git-send-email 2.39.3 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 0BA58120005 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 4n33prpndsjtbbsr8p5cs8898x5j6zao X-HE-Tag: 1718693678-279823 X-HE-Meta: U2FsdGVkX198V3au8v/FifDFxGx5ohZVu5I/WIVcUtahepcKRjLphme54ye1TlovQTKsvgetHg/uctqMX+sSifc56Uv6xOCjrZfHPCNzSqMJGaI3++M0Wqe/qdI3mTyPiUWhqtOhivCOc/EebM77nRo4zHeGBY+Vc7mTeGLkMt/xzhqpE1xy7rccuPOsojh8gkw4uuGkLSiXpETj3gdiOPGGRYLg+aInNSpPrs0eOtnBPrLpcSNcLxMoFfPR2gxhTUiRuDdfkJhwTF6RbjxUwYUbvIbT9op7EzsJO6ksTw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op: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: To support large folio swapin/swapout for shmem in the following patches, drop the folio's reference count by the number of pages contained in the folio when a shmem folio is deleted from shmem pagecache after adding into swap cache. Signed-off-by: Baolin Wang --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index c0a9253f3a99..9a35ee7e7f40 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -831,7 +831,7 @@ static void shmem_delete_from_page_cache(struct folio *folio, void *radswap) __lruvec_stat_mod_folio(folio, NR_FILE_PAGES, -nr); __lruvec_stat_mod_folio(folio, NR_SHMEM, -nr); xa_unlock_irq(&mapping->i_pages); - folio_put(folio); + folio_put_refs(folio, nr); BUG_ON(error); }