Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1865671rbb; Tue, 27 Feb 2024 03:57:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCViEaHMZquv8LtyRB923NJXuIV32XPp436cK8zOY6JPxJEeZyxmdnELznLPYbf8gggvAyJVwWw49OJOicJnb95dykubPKZVUUNrgpLDSQ== X-Google-Smtp-Source: AGHT+IGqEu2qoUbzthYX50Qp5NvxONbm1F0cU5JEC4ka3LFxDzAE7YBj132crjgdIDImsSiRFxK4 X-Received: by 2002:a05:6871:3325:b0:21f:cda:d027 with SMTP id nf37-20020a056871332500b0021f0cdad027mr12101911oac.54.1709035075899; Tue, 27 Feb 2024 03:57:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709035075; cv=pass; d=google.com; s=arc-20160816; b=dSwFoR61hCKzwstKMnsO8YzjiBfdj+p3NyChzXj3h1i+J0R/6bL3ckfsoMuSegGmMY ysc+uAOkaVHrvZRtHuNhhCtcGLgw70yjL2lehz0CMNqp6QFxSFOv3yxTT9x4kGuIHclR 3OLStCCtoid+zGgOIjjeAzp7rLf/m8F5+8q4b6aukYr6ijU+eacHcPk/ssLkS4djY5e/ i5+nDMPycBYKZmDu7ZpJ37VJ/uJkuDF5VC9eX+6Gcmzm+yrxrXsyjHH4Tj64PL+7ZhxM xCg2CVNPtd81yrObu0fgZWnMNFb6uoafOCwQOIxLowYNpffn7XF632/C92zRdz0fIKHd tJiw== 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-id :content-language:accept-language:in-reply-to:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-filter; bh=9NZAb323gBIz+kfWKWXT2Qoef/UCSAmPG14ZN7ecbFM=; fh=lzMdECLaAHPgMa16MglhGAwXvd7amDjb46tLn0kMBJk=; b=XCf187+kNbIxnHVg4w6iQknww9myG43T9AjytX87Dm8VTTNLVABQlL3q0aeyXlldb6 phVzOl178a/QK6LkUpsl/4gOwA1DjBV0LYQdw62h08gCrfu5QdHsnbMMHYFeePw1l1qu k4qycliB2W3quzVKcYq9U0/JmqZpWKkgF0BC5/GnQVxbM/0heqNh+NI5k22IN9cVP4Bq HILgd9UCy+s6tNauX0jdqhvC9zkt1ZXCFqgsbGhLX7MABEHZ0/RuXNpLexDTLKBgBJZw RTlVigWY/OSDYLHOQvkWJvpnM+c4dGc1xAhmpER6H9jQWAo2jLV/c3K77hNmgAiNYLMi 4AjQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="PM4n/0Sg"; 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-83138-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83138-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id kt9-20020a056a004ba900b006e53b977922si2178459pfb.171.2024.02.27.03.57.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 03:57:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83138-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="PM4n/0Sg"; 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-83138-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83138-linux.lists.archive=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 A119BB21EA4 for ; Tue, 27 Feb 2024 11:42:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DACB613A24C; Tue, 27 Feb 2024 11:42:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="PM4n/0Sg" 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 3D06B1386BF for ; Tue, 27 Feb 2024 11:42:11 +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=1709034134; cv=none; b=TqxNRuiaKGAUpr2xE4z9vogeeJRkZ18THD/y8TEBC7ikard9//gMrFDqOrBVAeSy3zKHlbfhskaakb0M4ksSSwnXPra5kFAKaPaJ+4DP0yU3pf2XfcpMBjJ8u3JxOf2wyf7v5d8/oKumWDXxr5SG9QkZ/KFcgKnan5ZuF0azYDc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709034134; c=relaxed/simple; bh=l8JyPh3KUUyVYVGPAmg1GAglhyb3oHIknNuJ/fa5eJY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:Content-Type: MIME-Version:References; b=BJUf+xCzxg+FIN1l0bsMKKEBRctIAOj7FYD05y0VHU8pGOB4xec2RnpNOMHl0oXAjjZOlGbBGd2CBfWq7Z0+tOgHkMJH51i2AAwmNjEHdF4MQNQ+803A8eveW/AeqY8qh1cg0aDpoGhLLau/rs2ADvhPuMTGdoVhIygHlmVotjM= 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=PM4n/0Sg; 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 eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20240227114204euoutp014e3883ade73c9d1ef6e8ad68a0635d35~3tXsiy_yJ0806608066euoutp01N for ; Tue, 27 Feb 2024 11:42:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20240227114204euoutp014e3883ade73c9d1ef6e8ad68a0635d35~3tXsiy_yJ0806608066euoutp01N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1709034124; bh=9NZAb323gBIz+kfWKWXT2Qoef/UCSAmPG14ZN7ecbFM=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=PM4n/0Sgb4SQrKUUn+JQDNaIloF8z/biaeaG4QZ8NyM53PwYU9Y3VE42Qx0Kc7vcp n9V/Zs3vbY/4INq0plS1/76paMjI0RGQ11sVz27T24mSneWNcWi9xIBmpL78PvD68q ZZCBKSpUs/nYaTohHufz6Tsv6a47qzOPm1aJFZkc= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20240227114203eucas1p2b2e419dded18da00b8324a89f8ce80ad~3tXsID21T1978519785eucas1p2p; Tue, 27 Feb 2024 11:42:03 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id DA.81.09814.B8ACDD56; Tue, 27 Feb 2024 11:42:03 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20240227114203eucas1p1ecacb1730fade22562318b58ac69b48d~3tXrnfip80667706677eucas1p1J; Tue, 27 Feb 2024 11:42:03 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20240227114203eusmtrp17eae2062c2cc345b40e3029cd2d55c30~3tXrmmTmf2906129061eusmtrp1W; Tue, 27 Feb 2024 11:42:03 +0000 (GMT) X-AuditID: cbfec7f4-727ff70000002656-93-65ddca8bed18 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 96.A6.10702.A8ACDD56; Tue, 27 Feb 2024 11:42:02 +0000 (GMT) Received: from CAMSVWEXC01.scsc.local (unknown [106.1.227.71]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240227114202eusmtip197888232c7483b0724d3b4d4af2dd178~3tXrcBZ-t1045210452eusmtip1J; Tue, 27 Feb 2024 11:42:02 +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; Tue, 27 Feb 2024 11:42:02 +0000 Received: from CAMSVWEXC02.scsc.local ([::1]) by CAMSVWEXC02.scsc.local ([fe80::3c08:6c51:fa0a:6384%13]) with mapi id 15.00.1497.012; Tue, 27 Feb 2024 11:42:02 +0000 From: Daniel Gomez To: Jan Kara CC: Hugh Dickins , "viro@zeniv.linux.org.uk" , "brauner@kernel.org" , "akpm@linux-foundation.org" , "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" Subject: Re: [RFC PATCH 0/9] shmem: fix llseek in hugepages Thread-Topic: [RFC PATCH 0/9] shmem: fix llseek in hugepages Thread-Index: AQHaW2RT7xV/K52STUGwCHRBbQ9MBbEKRvYAgAc7d4CAAZVngIAAJPeAgArwXwA= Date: Tue, 27 Feb 2024 11:42:01 +0000 Message-ID: In-Reply-To: <20240220123905.qdjn2x3dtryklibl@quack3> 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 Content-Type: text/plain; charset="us-ascii" Content-ID: <00717DEDED894B4ABA452342B0C962FB@scsc.local> Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02Sf0wTZxjH895dr0c3tqMweALdIDiyqVhUpLs5QraFzEsM7Ef2h25h2o13 gCvI7qiO8Q/RLMwaGDjxR1tDx8aPCgnmGE5QGq1ihcpkGyowgeGOBcHNWJqINq0bPVz63+eb 9/t8v8+TvAyp/V2VyJSUVWChzGhKpTXU6csPf153cGgSr5/zpXD2rk6aW7joQ9xwXYDmvPXN BDfrq6M429H9BHeuf5Difuuz09xU52MVN1Y/i7hrQY+KCyzZ6def5nutk2reIZn57vY1vHTy AM1LvkNq/sqxAMVfdVxS84vSC7wk/028E/WBJrsQm0r2YCEjZ6em+NexI+ry6sQvXJ67RDW6 F2dBUQywm2Ax2E9akIbRsu0IHrkbCEX4EUjHZtSKWEQQmOsinoycCt1QKQ9tCO5NXyD+d81Z mpAiriJwu27RinAiCPp/QMvzNLsaXIOSepnj2CSwXn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RIyEhu/XGWFsIUl/lzrYoMo+sgo 8WVhAwuEc4ZR4sa261DtKxkl1nVsYwFpYRPQlNh3chM7iC0iIC0x69hKsA5mgU8sEt1zVjOB JIQFrCVOHZ7FCFFkI7GpoZkJwvaT6N+8DcxmEVCV2LrrF9ggXgFfiX1XFgBt4wDa9pVJYns5 SJhTwFRi4rSZYGMYBWQlHq2EKGcWEJe49WQ+E8QLAhJL9pxnhrBFJV4+/gf1mo7E2etPoF42 kNi6dB8LhK0s8WpROyPEHB2JBbs/sUHYlhJbL+yDmq8tsWzha2aI0wQlTs58wjKBUWYWktWz kLTPQtI+C0n7LCTtCxhZVzGKpJYW56bnFhvpFSfmFpfmpesl5+duYgQmtW3Hfm7Zwbjy1Ue9 Q4xMHIyHGCU4mJVEeGUE76YK8aYkVlalFuXHF5XmpBYfYjQFBt1EZinR5HxgWs0riTc0MzA1 NDGzNDC1NDNWEuf1LOhIFBJITyxJzU5NLUgtgulj4uCUamCabunu0rXx0qK8WJO/1uo1u9ec tXk55e/WesXlF49HTNJW6Dh8IT5ZV91WV3jXk5vnxLo9My64nK7RTJ21692ruVeVrz/MEP3n X2VzwXVu7cuqLb9EamPW3rkQlHFT+AJ7eWqS6ZoLL/5N2ubDeebRGqdtIh2dexbNru5wZS7u cNnVYVYgnjLrXccxeeOGre4Hff2mRGs9vuvz3/6VOotuTvbyhIJ72t9v7Llaf8ha1a7o8f83 nn6869XXOjj9WWCae2eeNEP5joJ6ztUa9wxaeqapXLUNlQ3KaKv96BmSKtE7KW2/AMNOuSe6 55Qz3AWN3z2xvdCzzedvUYgYl9Jj5XOxE5qnTfO87WPycrsSS3FGoqEWc1FxIgCeYCCa8wMA AA== X-CMS-MailID: 20240227114203eucas1p1ecacb1730fade22562318b58ac69b48d X-Msg-Generator: CA X-RootMTR: 20240214194911eucas1p187ae3bc5b2be4e0d2155f9ce792fdf8b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20240214194911eucas1p187ae3bc5b2be4e0d2155f9ce792fdf8b References: <20240209142901.126894-1-da.gomez@samsung.com> <25i3n46nanffixvzdby6jwxgboi64qnleixz33dposwuwmzj7p@6yvgyakozars> <20240220123905.qdjn2x3dtryklibl@quack3> On Tue, Feb 20, 2024 at 01:39:05PM +0100, Jan Kara wrote: > On Tue 20-02-24 10:26:48, Daniel Gomez wrote: > > On Mon, Feb 19, 2024 at 02:15:47AM -0800, Hugh Dickins wrote: > > I'm uncertain when we may want to be more elastic. In the case of XFS w= ith iomap > > and support for large folios, for instance, we are 'less' elastic than = here. So, > > what exactly is the rationale behind wanting shmem to be 'more elastic'= ? >=20 > Well, but if you allocated space in larger chunks - as is the case with > ext4 and bigalloc feature, you will be similarly 'elastic' as tmpfs with > large folio support... So simply the granularity of allocation of > underlying space is what matters here. And for tmpfs the underlying space > happens to be the page cache. But it seems like the underlying space 'behaves' differently when we talk a= bout large folios and huge pages. Is that correct? And this is reflected in the = fstat st_blksize. The first one is always based on the host base page size, regar= dless of the order we get. The second one is always based on the host huge page s= ize configured (at the moment I've tested 2MiB, and 1GiB for x86-64 and 2MiB, 5= 12 MiB and 16GiB for ARM64). If that is the case, I'd agree this is not needed for huge pages but only w= hen we adopt large folios. Otherwise, we won't have a way to determine the step= / granularity for seeking data/holes as it could be anything from order-0 to order-9. Note: order-1 support currently in LBS v1 thread here [1]. Regarding large folios adoption, we have the following implementations [2] = being sent to the mailing list. Would it make sense then, to have this block trac= king for the large folios case? Notice that my last attempt includes a partial implementation of block tracking discussed here. [1] https://lore.kernel.org/all/20240226094936.2677493-2-kernel@pankajragha= v.com/ [2] shmem: high order folios support in write path v1: https://lore.kernel.org/all/20230915095042.1320180-1-da.gomez@samsung.c= om/ v2: https://lore.kernel.org/all/20230919135536.2165715-1-da.gomez@samsung.c= om/ v3 (RFC): https://lore.kernel.org/all/20231028211518.3424020-1-da.gomez@sam= sung.com/ >=20 > > If we ever move shmem to large folios [1], and we use them in an oportu= nistic way, > > then we are going to be more elastic in the default path. > >=20 > > [1] https://lore.kernel.org/all/20230919135536.2165715-1-da.gomez@samsu= ng.com > >=20 > > In addition, I think that having this block granularity can benefit quo= ta > > support and the reclaim path. For example, in the generic/100 fstest, a= round > > ~26M of data are reported as 1G of used disk when using tmpfs with huge= pages. >=20 > And I'd argue this is a desirable thing. If 1G worth of pages is attached > to the inode, then quota should be accounting 1G usage even though you've > written just 26MB of data to the file. Quota is about constraining used > resources, not about "how much did I write to the file". But these are two separate values. I get that the system wants to track how= many pages are attached to the inode, so is there a way to report (in addition) = the actual use of these pages being consumed? >=20 > Honza > --=20 > Jan Kara > SUSE Labs, CR=