From patchwork Wed May 15 05:57:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 13664603 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 22DD0C25B75 for ; Wed, 15 May 2024 05:57:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 46B576B011C; Wed, 15 May 2024 01:57:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F44B6B0125; Wed, 15 May 2024 01:57:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 15DF86B0121; Wed, 15 May 2024 01:57:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DFF4F6B0115 for ; Wed, 15 May 2024 01:57:34 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 8E195804E3 for ; Wed, 15 May 2024 05:57:34 +0000 (UTC) X-FDA: 82119573228.06.17F8D4F Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by imf12.hostedemail.com (Postfix) with ESMTP id 9CBD04001B for ; Wed, 15 May 2024 05:57:31 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=u4gdewf9; dmarc=pass (policy=none) header.from=samsung.com; spf=pass (imf12.hostedemail.com: domain of da.gomez@samsung.com designates 210.118.77.12 as permitted sender) smtp.mailfrom=da.gomez@samsung.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715752651; 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:dkim-signature; bh=LR6zBAqCV5AW0imgsMiCR7+GSDVrb77Uvzm1KnB3t5Q=; b=k140ryhbT4iiUXRRKMLul7ufsErUp65ya2qmmIlr14d0mfL1QLTeEmHcmloeS2rHbJxquj 4eA20+5aJNUqk/6SBvLAYkffO04NJQsKE7wB8RwONhxxRQPMc1z66F9AJpxvHVxuvEMQb5 vR4d2d96MpE5SE2WppjeaBFUGTOTx/E= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715752651; a=rsa-sha256; cv=none; b=ay1GauDK8S+OjFe+xHF1F+7uHtymeNmlVTWrf6YHIQVnza3O9f0pxQ1QrIC6YZWN4i5wLi dWsaSqfgBDIOIquTJiFW7Z68nPhU87JzO5//n0y6Sjk2PWBcpiIK0njOBaaQbMtn+kVjSK Qkp3sh36XQiXopazSZSi/4uWQcgbcpI= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=u4gdewf9; dmarc=pass (policy=none) header.from=samsung.com; spf=pass (imf12.hostedemail.com: domain of da.gomez@samsung.com designates 210.118.77.12 as permitted sender) smtp.mailfrom=da.gomez@samsung.com Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20240515055730euoutp0251516c73db872ad34c91c4ef02fa27a3~Pk-HjDUMX1334513345euoutp02S for ; Wed, 15 May 2024 05:57:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20240515055730euoutp0251516c73db872ad34c91c4ef02fa27a3~Pk-HjDUMX1334513345euoutp02S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1715752650; bh=LR6zBAqCV5AW0imgsMiCR7+GSDVrb77Uvzm1KnB3t5Q=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=u4gdewf9aJ1/hhtGBiE/AmTK+E5NWKJWqtb2PRSlRy83TSAxt4f3BpHcof9oHbueN MzhWqh/cQJSDFsGv8sy8w4ztloQ2ME+6LaNnRwvwsRd6kpdoAxXP4czSSaz95blMV0 +IyiWcyKqbhQsY6Q5tpyQPHYqJ/qj4t9yFEv2zHE= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20240515055729eucas1p1783caa60b5809909e5f5f02340a8b5e9~Pk-HRYZK_2872228722eucas1p1g; Wed, 15 May 2024 05:57:29 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id BB.BC.09624.9CE44466; Wed, 15 May 2024 06:57:29 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20240515055729eucas1p14e953424ad39bbb923c64163b1bbd4b3~Pk-Gop9GA2569725697eucas1p19; Wed, 15 May 2024 05:57:29 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20240515055729eusmtrp1fe48c4be7bfa2cd516577c63c5d4fcec~Pk-GoCb900390703907eusmtrp15; Wed, 15 May 2024 05:57:29 +0000 (GMT) X-AuditID: cbfec7f2-bfbff70000002598-56-66444ec9e21e Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 4C.16.08810.9CE44466; Wed, 15 May 2024 06:57:29 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240515055728eusmtip16c7550411a40722fd434edbb57cdb6d4~Pk-GdPs9a0562305623eusmtip1T; Wed, 15 May 2024 05:57:28 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 15 May 2024 06:57:28 +0100 Received: from CAMSVWEXC02.scsc.local ([::1]) by CAMSVWEXC02.scsc.local ([fe80::3c08:6c51:fa0a:6384%13]) with mapi id 15.00.1497.012; Wed, 15 May 2024 06:57:28 +0100 From: Daniel Gomez To: "hughd@google.com" , "akpm@linux-foundation.org" , "willy@infradead.org" , "jack@suse.cz" , "mcgrof@kernel.org" CC: "linux-mm@kvack.org" , "linux-xfs@vger.kernel.org" , "djwong@kernel.org" , "Pankaj Raghav" , "dagmcr@gmail.com" , "yosryahmed@google.com" , "baolin.wang@linux.alibaba.com" , "ritesh.list@gmail.com" , "lsf-pc@lists.linux-foundation.org" , "david@redhat.com" , "chandan.babu@oracle.com" , "linux-kernel@vger.kernel.org" , "brauner@kernel.org" , Daniel Gomez Subject: [PATCH 05/12] shmem: clear_highpage() if block is not uptodate Thread-Topic: [PATCH 05/12] shmem: clear_highpage() if block is not uptodate Thread-Index: AQHapozEyRWHtpwfgE2CvOQjrDJhgA== Date: Wed, 15 May 2024 05:57:28 +0000 Message-ID: <20240515055719.32577-6-da.gomez@samsung.com> In-Reply-To: <20240515055719.32577-1-da.gomez@samsung.com> Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [106.210.248.161] MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrEKsWRmVeSWpSXmKPExsWy7djPc7on/VzSDJrmGlrMWb+GzeL/3mOM Fq8Pf2K0uHRUzuJs3282i6/rfzFbXH7CZ/H0Ux+LxezpzUwWl3fNYbO4t+Y/q8WuPzvYLfa9 3stscWPCU0aLg6c62C1+/wDKbt8V6SDosXPWXXaP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n1NSf+ SAi/Ubx757y8O0oOyc7mvtcTUlWVDHjCxPr2u7XbrLQLqok/V+47xX+t+KJNTX3Tz7z4GSCx MJ8z7GnU6bcZrHE9v3/+DJ6nYqmSFrd5Dc+N9erB95w+193devD39GXbeZ7K1E1sfq132CyP g2P/l4jzER/eK7EUZyQaajEXFScCAKuYz08CBAAA X-CMS-MailID: 20240515055729eucas1p14e953424ad39bbb923c64163b1bbd4b3 X-Msg-Generator: CA X-RootMTR: 20240515055729eucas1p14e953424ad39bbb923c64163b1bbd4b3 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20240515055729eucas1p14e953424ad39bbb923c64163b1bbd4b3 References: <20240515055719.32577-1-da.gomez@samsung.com> X-Stat-Signature: sy9qapurrbxnrn87ssyf9gxhhnjk6equ X-Rspamd-Queue-Id: 9CBD04001B X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1715752651-49628 X-HE-Meta: U2FsdGVkX18Av2fbXyYvlQh+5/1jyVonOUBiTqPu3fml3F8Nap1hdXuFQYut9L7f3DkibrjkmD1X5NSLT4IqabqXryxcBlTlKgIvaELM075iuzLsc81PY/RoOAbCCYfBoWvt0QvLfsH8Z0noqFjRWinHJweFqpsQKmAcGCiAEKmhJPb6p6L6ieZMDmAiGkeTyoZ55zieY0O3zqt0sejn71X8e9DCYtgp0fsyfat1pTfgJ2FxbziSoK+XqgCGHd+ftJPvR5wwFcXoIekfCqfpdVNjIdkPvBmORO5pyOzJeESKUVk6W8l+96fvmaa/19VuIaYWGU5xHXB19D2tp3GzBD9NkVJCFr8/PXdi0kStZW2VQS8lOHN4sQSjL/TXVL/HJY1kRJ2oQmv3z0HN7nlwuTB1na4W5ahB3COaWCWJtazHZE6HLyUS8eXf+kNVBSt7suucl3FnzsHVsz0FezUugf7LEQIuCfaLiDQYJuRkY90kHckez0re/3G+DfjHfQXD8XtubdxBhGS1fD/P90Z5tO2ty7yFf0D8kL1HPB6K4hjRvF2E6+3SSjFMmjxHo9BQCEum+T7T8b8jjtQ5/AcRk2WDFkpjlZrrE2OiB7fxj0oo49pDjzrmZpyrDEnadg8ibJwbFkP3UKGDQg8CJESDwZ2FV9+fit1VkOIaRGxNTGn5GfYT1DvgWnfVfvPTHFCgEwjSI+6hf1DBjOxxFmhnbu/GSHjtM8jyuCNK3ufpnBxUuPNepOIb9AQyxt907MOVuO5ElsL1Nvfo/EA1BFkZd8YM8SwAp6+YKZtwpxNoVqse/MQdhS4F0dYEBCHftg1QeYeYV7knT9tinGuGiZteaLYO+mYNpbDinXZv9y3Q4k8z252jBNxLGciqatjnWGBFletvP3d4/COMR9IxhHL4huPUc6tK7SYyswVTDvALAuP6QJT2/idxdd/tPqs6+K2prxo3+z5mOX3U80ka0lX 7s+vkP3G nQssHxmy04JHpPPndQoo0Ax7tTiaQBBncExyJQM/8prPKr5ZeAzTMvIILs4xeloABILbnq/W/IMvjrxS3DKB4ESYSu8pMG/pW1l6z0LroI35bVMDCbmYZ7h3qAn1NCHUQw7KClxDBJU/GEdjgeV3U+yxOL+KZCatiLMCa59VupFPf2QhiD5mhnbD9Gi4VvA72o2cH3Neo1WCaC6ovHOhrfjSZeeQy5EdsyQwlHSjZt+w+kigLFumvSKDDBKXGQGaMYQNtK15tFwo3o07MBY4vopWAtA== 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: clear_highpage() is called for all the subpages (blocks) in a large folio when the folio is not uptodate. Do clear the subpages only when they are not uptodate. Signed-off-by: Daniel Gomez --- mm/shmem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index 69f3b98fdf7c..04992010225f 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2256,7 +2256,8 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index, long i, n = folio_nr_pages(folio); for (i = 0; i < n; i++) - clear_highpage(folio_page(folio, i)); + if (!shmem_is_block_uptodate(folio, i)) + clear_highpage(folio_page(folio, i)); flush_dcache_folio(folio); shmem_set_range_uptodate(folio, 0, folio_size(folio)); }