From mboxrd@z Thu Jan 1 00:00:00 1970 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 A6477C47DD9 for ; Wed, 28 Feb 2024 15:50:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C4F876B0074; Wed, 28 Feb 2024 10:50:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BD7DC6B007D; Wed, 28 Feb 2024 10:50:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DD586B0099; Wed, 28 Feb 2024 10:50:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8C8056B0074 for ; Wed, 28 Feb 2024 10:50:17 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 1E51AA0F00 for ; Wed, 28 Feb 2024 15:50:17 +0000 (UTC) X-FDA: 81841649274.05.DA609D1 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by imf07.hostedemail.com (Postfix) with ESMTP id C08FD4001F for ; Wed, 28 Feb 2024 15:50:13 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=GeNE0TGA; spf=pass (imf07.hostedemail.com: domain of da.gomez@samsung.com designates 210.118.77.12 as permitted sender) smtp.mailfrom=da.gomez@samsung.com; dmarc=pass (policy=none) header.from=samsung.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709135414; 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=zJQNDKkL21r6aqDh+Pd7p8kIqJDT8RuvNrtky0wFojU=; b=ebL0iAf548h/JvtUjgluFAMV8B7QsC/17DFS48OeTVu/nvU9IqhKR64DycP6ghEZvgXGb/ LsxyCN+xgmwyU0nbA/kkyWJV+FAIU8M465GQ6Kx0UXqkIOOYy4t86eq8GV47amA49jxBjk hcIQUMF83Ct+zfJVdqcxWi7j6FTpp2M= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=GeNE0TGA; spf=pass (imf07.hostedemail.com: domain of da.gomez@samsung.com designates 210.118.77.12 as permitted sender) smtp.mailfrom=da.gomez@samsung.com; dmarc=pass (policy=none) header.from=samsung.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709135414; a=rsa-sha256; cv=none; b=eCIBt22Ysk/I9YE5Z7XtSQh6mBPmoKSJhXnCxXKNtFiXrS8Q4/2fYcHAxbqABIBXKf6iAr 8oDpaxOmfHA3E39ZFkzkRsRh4BRYV/Uc+ro/ZFimeVq7a7qzHG39FUa+xW7InNBeenkR5W PY5u5unXtuKvjXoV2bBTY8ioJdh6iKw= Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20240228155011euoutp021b0e08d5d4407b802d6b30dae7161c92~4EZnylMh50409904099euoutp02P for ; Wed, 28 Feb 2024 15:50:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20240228155011euoutp021b0e08d5d4407b802d6b30dae7161c92~4EZnylMh50409904099euoutp02P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1709135411; bh=zJQNDKkL21r6aqDh+Pd7p8kIqJDT8RuvNrtky0wFojU=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=GeNE0TGAF3F1I64PWxLS+Cnt2s8Ki49LWyBg5eQR5OoVBb1MjrXLIZ8j9dS0WWcNs /uieBjYx2+8wp9W2IDMsDyipLYe+MPetV4cJGO3xuWEEHTqhe9NWTcLj4MQT3IWnQu vSjTr5luyhC7SXokii9y5Tva/g/pwKWZq5t2fUNQ= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20240228155010eucas1p208db80ff52de37bfee321a2d5fd008c0~4EZnPxfO62088320883eucas1p2J; Wed, 28 Feb 2024 15:50:10 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 13.4B.09814.2365FD56; Wed, 28 Feb 2024 15:50:10 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20240228155010eucas1p2806c87bd10048751fc10b0208d1c9ba7~4EZmtgReR2969229692eucas1p2m; Wed, 28 Feb 2024 15:50:10 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20240228155010eusmtrp1e464ab5e705be901da71fd784de2e04d~4EZmsu7S21793817938eusmtrp1S; Wed, 28 Feb 2024 15:50:10 +0000 (GMT) X-AuditID: cbfec7f4-711ff70000002656-6f-65df5632106c Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 77.94.09146.2365FD56; Wed, 28 Feb 2024 15:50:10 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240228155010eusmtip1a777fa7a10cfd8ede49aa8efc6099de7~4EZmhlrUS2327423274eusmtip1B; Wed, 28 Feb 2024 15:50:10 +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, 28 Feb 2024 15:50:09 +0000 Received: from CAMSVWEXC02.scsc.local ([::1]) by CAMSVWEXC02.scsc.local ([fe80::3c08:6c51:fa0a:6384%13]) with mapi id 15.00.1497.012; Wed, 28 Feb 2024 15:50:09 +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/K52STUGwCHRBbQ9MBbEKRvYAgAc7d4CAAZVngIAAJPeAgArwXwCAAdelgA== Date: Wed, 28 Feb 2024 15:50:08 +0000 Message-ID: In-Reply-To: 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.179] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNKsWRmVeSWpSXmKPExsWy7djPc7pGYfdTDRY8NbKYs34Nm8Xrw58Y Lc72/WazOD1hEZPF0099LBazpzczWezZe5LF4vKuOWwW99b8Z7W4MeEpo8X5v8dZLX7/mMPm wOOxc9Zddo8Fm0o9Nq/Q8ti0qpPNY9OnSeweJ2b8ZvE4s+AIu8fnTXIem568ZQrgjOKySUnN ySxLLdK3S+DKuHjuEGPBAdmK9b2rWBsYN4p3MXJySAiYSPR3nmLvYuTiEBJYwShxfMEJVgjn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 20240228155010eucas1p2806c87bd10048751fc10b0208d1c9ba7 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> X-Rspamd-Queue-Id: C08FD4001F X-Rspam-User: X-Stat-Signature: subyou85yjjdr1xr4z9hbewee888yh8b X-Rspamd-Server: rspam01 X-HE-Tag: 1709135413-117544 X-HE-Meta: U2FsdGVkX1/KGzH3dKSwfw8UIF1jcndwK3i0HtXQL4qhXCB3sdhv+bVy/h841yvSW4rhRDn/bSrG+39DaSYs8BLmZoihC1GdV2kEdGyDqm+z/S6/cv2k7842EUzGdSFI5UKlowfgnJlyCyUeGQQGgu8oSu4jJ/QtKbTCJHljm99fiTY+Dx3wWJIjVIptIGEt26j0B4r9oMTDE6l4jyR8u0R92u7kStx7tnhlQOTi3io5ZWEXxYp0jnkDCWE5nqxE+FxIV3TXBNy0ZezB5G0NqcrljQtDvzhyoD1TyXFzdU5k3qDgQ6g8Dbwo4F+lvDC0417d8mDRF0pfGNvTGYCLqfXrqrz6LIQZaolshBHUByn6c+dxytDWwB64oLADis58N+GnM+ToKPOiGojzlK91v0EYVJv4gHMMu4cvFd5cGixcjtnd0aoKa8qzLNXXvepU4Xwgee6Yh3NCRdrI4fSOmAGAAEQ/HaGJvS+syPDR9QQsSlMikiaL/sIK4dALL9jrBXyxZl/4wOqzxi111Wsazh92WTbL9ZgCviDjeidwSb9JDgS1Ku5+LO47k9EpkEiyc5KJFwOfFgkUQ3JPPio5bYl4PHDU7K7Y/b39nvUrjgLud2zkgwW0kZOEkIEAJQM/gEur77rvsasBXauDp8FBCXV5mXNwpw5gysfJjKOG3sFlHlXIl9X1quUlrX4vEk1zKDEKlVaTlulEE1w3R2cir+foDbKLaMKMfCu1cEeK54zm29zIlfkdMVd+GyZuCGN1OOIHxn8fDHI8pOqn6SC8GpSGGtw5KEN7oj3A/Z2NybwLQ3rzqP2pg7PXbvOscraaVZ1J8yTMhViBJNMs5EISupNoL5hlqw9wwyFL4zm8V6onfk+yPZKKy/OZLH9apsb6rHdkGe0tmnotu7R32Zt+7fi9kn1O7uVPe5Z3MtB15piQfinCp7Q0RyAhheUH02CsDx1Cy62rtdFXyyEoZjD jIjcrEct fhbvfunMKCysj4qCzfrW1aePmI3YkYJ5XGaqzULo+awdkas1Zme3L3VQ+DyeTPyA4VbNE 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: On Tue, Feb 27, 2024 at 11:42:01AM +0000, Daniel Gomez wrote: > 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= with iomap > > > and support for large folios, for instance, we are 'less' elastic tha= n here. So, > > > what exactly is the rationale behind wanting shmem to be 'more elasti= c'? > >=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 wit= h > > large folio support... So simply the granularity of allocation of > > underlying space is what matters here. And for tmpfs the underlying spa= ce > > happens to be the page cache. >=20 > But it seems like the underlying space 'behaves' differently when we talk= about > large folios and huge pages. Is that correct? And this is reflected in th= e fstat > st_blksize. The first one is always based on the host base page size, reg= ardless > of the order we get. The second one is always based on the host huge page= size > configured (at the moment I've tested 2MiB, and 1GiB for x86-64 and 2MiB,= 512 > MiB and 16GiB for ARM64). Apologies, I was mixing the values available in HugeTLB and those supported= in THP (pmd-size only). Thus, it is 2MiB for x86-64, and 2MiB, 32 MiB and 512 = MiB for ARM64 with 4k, 16k and 64k Base Page Size, respectively. >=20 > If that is the case, I'd agree this is not needed for huge pages but only= when > we adopt large folios. Otherwise, we won't have a way to determine the st= ep/ > granularity for seeking data/holes as it could be anything from order-0 t= o > order-9. Note: order-1 support currently in LBS v1 thread here [1]. >=20 > 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 tr= acking > for the large folios case? Notice that my last attempt includes a partial > implementation of block tracking discussed here. >=20 > [1] https://lore.kernel.org/all/20240226094936.2677493-2-kernel@pankajrag= hav.com/ >=20 > [2] shmem: high order folios support in write path > v1: https://lore.kernel.org/all/20230915095042.1320180-1-da.gomez@samsung= .com/ > v2: https://lore.kernel.org/all/20230919135536.2165715-1-da.gomez@samsung= .com/ > v3 (RFC): https://lore.kernel.org/all/20231028211518.3424020-1-da.gomez@s= amsung.com/ >=20 > >=20 > > > If we ever move shmem to large folios [1], and we use them in an opor= tunistic 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@sam= sung.com > > >=20 > > > In addition, I think that having this block granularity can benefit q= uota > > > support and the reclaim path. For example, in the generic/100 fstest,= around > > > ~26M of data are reported as 1G of used disk when using tmpfs with hu= ge pages. > >=20 > > And I'd argue this is a desirable thing. If 1G worth of pages is attach= ed > > 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". >=20 > But these are two separate values. I get that the system wants to track h= ow 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 > >=20 > > Honza > > --=20 > > Jan Kara > > SUSE Labs, CR=