From patchwork Fri Feb 9 14:29:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 198928 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp899891dyd; Fri, 9 Feb 2024 06:44:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXnqvqz6WF2xHDX1OmCv1TTFqL9d5loh+cdyGKAYOS99BVCn40c3U3CXhlH/XGdL8ds7VlbuTHVEcg9Dtz4nusOjNAYAA== X-Google-Smtp-Source: AGHT+IFGnzAnNCgcvIfJWUC+pUJEqdMAeNxej8Z87tNgSsgT1snpeRxtexqhw66EHQJ6mQjCAvO7 X-Received: by 2002:a92:d4cf:0:b0:363:b33e:c8f2 with SMTP id o15-20020a92d4cf000000b00363b33ec8f2mr2148402ilm.11.1707489852876; Fri, 09 Feb 2024 06:44:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707489852; cv=pass; d=google.com; s=arc-20160816; b=pj7HH7dzROjo3XLlpXFu514dEeGg9CAccfnxdpIcxMa1zb4yD9AMxSqlmyf0fFOs56 7iXsvam85gakWKTZ9xoD0bRv5pgW1m54BAjj7m1R9q2u0mMNWhFNQ5cKlexh4LD1h9tu SpC1L3BQpDkCWIbTi7juIa6w8Yxh9LTsaP64OtnKKon9aPYDn0kw+NhU9wU7fa072cNt Mbh3gBQ91f6FQJniMLFNM5Y0UqBDTIUebGot0vm5mC2shLg/8ANlhQYMi9gCETK+mtHg mF4tmiaGPbdUN2f7ZnPEkLFkIFm3i7adgkA/u5gz3D7yAwroKcIJBmwLYH//w/fACG7h IKmA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:cms-type:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:content-transfer-encoding:content-language :accept-language:in-reply-to:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature:dkim-filter; bh=FCbzId5tUUljaKo+tPW5dyPNAxWuqwZJmK4aFsnXX4M=; fh=Ea4LWx0zk3O3tXZ1GtPxhyYPa8NaV43PTFb5SXdGTJE=; b=Oa3EUFXG8W9YC/bqlQqGxJoUUIfHcWRKhSeui+nzQC4HGTI8cIleG9ar9aKUSsGJO+ J0+cUIIoStw2bFQgdwr4U0cvqICrm9s1pXqAYjmGY5ckBE9CZSre3L34a8gRXc9tcxea Ch1mcdhkzLiYgXDyo5ndioDTckgLiKRj9LELcFBGMNby8xtUK9LPokAfuguhzEUGdTIS sd+3vUORyrbAnNRzGnXrsi7Llf66DGyni1CsqYVLX0Jy1toH/evpaesHt3bbbNKrjGOI Kfgbt4FHxT2xpeeXSw03JTU1EifXqvt95P8KLYNgh3NTwrOHw/GFun7fCg1WUpOS6JZ/ kRPA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=h1JyNx4K; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-59455-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59455-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com X-Forwarded-Encrypted: i=2; AJvYcCVEqOmMpvROoEnL+HX65WlmdeIOtzvton5traGAT8Dj9ejj9GD2sxylvzC01l5jI94ajEfmog14yDx2YCyPZKAJeGcGXA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k64-20020a632443000000b005d8fdaafe5bsi1767231pgk.550.2024.02.09.06.44.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 06:44:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59455-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=h1JyNx4K; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-59455-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59455-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4F092B27045 for ; Fri, 9 Feb 2024 14:32:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5915174E28; Fri, 9 Feb 2024 14:29:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="h1JyNx4K" Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DA3A69D26 for ; Fri, 9 Feb 2024 14:29:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488952; cv=none; b=EsO0T6AzCCAus2f8WnO9Us/4za87ItGPi15+hi8dqicNVYwy6sU/5wx34DhYV6uMEEohPnEORFYIJQ5+nKhChtkwQpRecn3HLhNoSDN3CH90721r7p9XF451OESHEWdWI9GXq2BWaf0RSCeKeoD6Khh/DPF3l2UpHAqZ3cOcbWE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488952; c=relaxed/simple; bh=CPKJ6tUdoDF6Ha2IQ+4O/WOu+/5VM901pX9Tu0quqfk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:Content-Type: MIME-Version:References; b=ZGHspLpMxrSlFReQa+ygpkn+AGufDeUf1TPHnWXCPJkgEZmQ1FAxuA7JnUAFprVR3sh9HC9Y/D3BPQ+3hmgOuZwVgN5snhoyQjJqdsHzR8iDPZ73DoaWJoNNq/8feH8a7JMmznroTGij8heb8YRjlsEU9OOWlVHVrzDvp5WXx3M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=h1JyNx4K; arc=none smtp.client-ip=210.118.77.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20240209142906euoutp017389e53649f75be9c6da7e5fe213ad9e~yOCZ_oe3d2559825598euoutp01S for ; Fri, 9 Feb 2024 14:29:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20240209142906euoutp017389e53649f75be9c6da7e5fe213ad9e~yOCZ_oe3d2559825598euoutp01S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1707488946; bh=FCbzId5tUUljaKo+tPW5dyPNAxWuqwZJmK4aFsnXX4M=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=h1JyNx4KMrteOAQd2xuXTYL0v8bGy8abrDejKZj6MfmF7XkTeUYjJO/0mlcML6jxY LVoThPtZVowwXE1i4ym/GrWCFWwXiJyUXv4z+NRkk11J5mp12q17wL1A1sDkfrNlA3 SQ5JHpmxkcLYKefpwei3RORrbhDJGjstMZeYyjgw= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20240209142906eucas1p2e47a246a10373a76799a079725583da1~yOCZtNsY_2329623296eucas1p2e; Fri, 9 Feb 2024 14:29:06 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id FC.F5.09814.2B636C56; Fri, 9 Feb 2024 14:29:06 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20240209142905eucas1p14498619591475e416a8163dbc96c90e4~yOCZTs0l-0937309373eucas1p16; Fri, 9 Feb 2024 14:29:05 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240209142905eusmtrp2a5418fa28a2ffb3a4fc54948ca8a399d~yOCZTFUmN2110121101eusmtrp2b; Fri, 9 Feb 2024 14:29:05 +0000 (GMT) X-AuditID: cbfec7f4-711ff70000002656-40-65c636b2e6b8 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 59.6F.09146.1B636C56; Fri, 9 Feb 2024 14:29:05 +0000 (GMT) Received: from CAMSVWEXC01.scsc.local (unknown [106.1.227.71]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240209142905eusmtip2236828047c1df8be3fea7df7e76daca2~yOCZK_AE42332823328eusmtip2R; Fri, 9 Feb 2024 14:29:05 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) by CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 9 Feb 2024 14:29:05 +0000 Received: from CAMSVWEXC02.scsc.local ([::1]) by CAMSVWEXC02.scsc.local ([fe80::3c08:6c51:fa0a:6384%13]) with mapi id 15.00.1497.012; Fri, 9 Feb 2024 14:29:05 +0000 From: Daniel Gomez To: "viro@zeniv.linux.org.uk" , "brauner@kernel.org" , "jack@suse.cz" , "hughd@google.com" , "akpm@linux-foundation.org" CC: "dagmcr@gmail.com" , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "willy@infradead.org" , "hch@infradead.org" , "mcgrof@kernel.org" , Pankaj Raghav , "gost.dev@samsung.com" , "Daniel Gomez" Subject: [RFC PATCH 5/9] shmem: clear_highpage() if block is not uptodate Thread-Topic: [RFC PATCH 5/9] shmem: clear_highpage() if block is not uptodate Thread-Index: AQHaW2RUm+AjPQwetUKmMMbff0NR9g== Date: Fri, 9 Feb 2024 14:29:03 +0000 Message-ID: <20240209142901.126894-6-da.gomez@samsung.com> In-Reply-To: <20240209142901.126894-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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrPKsWRmVeSWpSXmKPExsWy7djP87qbzI6lGnz7JWYxZ/0aNovXhz8x Wpzt+81mcXrCIiaLp5/6WCxmT29mstiz9ySLxeVdc9gs7q35z2pxY8JTRovzf4+zWvz+MYfN gcdj56y77B4LNpV6bF6h5bFpVSebx6ZPk9g9Tsz4zeJxZsERdo/Pm+Q8Nj15yxTAGcVlk5Ka k1mWWqRvl8CVsfnoYcaCrWwVn2evZ2tgXMDa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UnAgAorJ4Z94DAAA= X-CMS-MailID: 20240209142905eucas1p14498619591475e416a8163dbc96c90e4 X-Msg-Generator: CA X-RootMTR: 20240209142905eucas1p14498619591475e416a8163dbc96c90e4 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20240209142905eucas1p14498619591475e416a8163dbc96c90e4 References: <20240209142901.126894-1-da.gomez@samsung.com> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790432879630540907 X-GMAIL-MSGID: 1790432879630540907 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 614cda767298..b6f9a60b179b 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2253,7 +2253,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)); }