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 CE64AC3DA5D for ; Mon, 22 Jul 2024 09:35:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63FD16B0085; Mon, 22 Jul 2024 05:35:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EFF06B0088; Mon, 22 Jul 2024 05:35:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 469636B0089; Mon, 22 Jul 2024 05:35:20 -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 2967D6B0085 for ; Mon, 22 Jul 2024 05:35:20 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 99F281A153D for ; Mon, 22 Jul 2024 09:35:19 +0000 (UTC) X-FDA: 82366880358.02.50DC349 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by imf01.hostedemail.com (Postfix) with ESMTP id 51AC940007 for ; Mon, 22 Jul 2024 09:35:16 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=KojORy2p; spf=pass (imf01.hostedemail.com: domain of da.gomez@samsung.com designates 210.118.77.11 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=1721640893; a=rsa-sha256; cv=none; b=si8gJCg9mBN7nLbF6U8GrJNJZ+HORBlKsomMCfl9T9nnI7sp/QkHi67TdzODjK1QB8rQiS 9ih5fhQH0J1dvai5Y1fjVhN5WuWsoK7CJGe1CtbjjQH1dFMLCut9D+cL6Jp/cFJ0YIPoUO fL0F2PQUIU/F5wDKtQKDrwjHF6jYH0g= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=KojORy2p; spf=pass (imf01.hostedemail.com: domain of da.gomez@samsung.com designates 210.118.77.11 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=1721640893; 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=JTOj1r/QirQnbxz+lycvoW95ymFanaa09xD21a8hr0g=; b=AW+jwdmzLE5vDqqLCAM6yEAWvuySACGYmxusIq4xWbgw0gGFmdJI4Ouk8H/F6hHpLmvfGP XcD4wsscUSM0EEumkZmnJ6ED0uZfFO6EcRhgJ9v4HigvUSRMfqPJ/jzeM7epWvYCxi/Dyp dn9My0MLENmuF6IU0vijKVY0LbLXcxs= Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20240722093513euoutp01bc58e08d3044bbd01e840160a487046c~kf0oSugLV0870208702euoutp01D for ; Mon, 22 Jul 2024 09:35:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20240722093513euoutp01bc58e08d3044bbd01e840160a487046c~kf0oSugLV0870208702euoutp01D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1721640913; bh=JTOj1r/QirQnbxz+lycvoW95ymFanaa09xD21a8hr0g=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=KojORy2pIswD1LP05X9sULVMz1WA9cnWc5uCvuNf+y7VIAHT9+8o7zqAtnq/fUDPP 9omZ4+6PMXv/fycLVf44qInG8O7c5FSLimSYwrboWn8t9HblDmz3I/30VGzo4NBQ8/ x2WI1fUymhzut/S0661k3EcULZKCXq1v4/2V5mlY= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20240722093513eucas1p20b9ceabff256c8cd34349094136a39f0~kf0oFC8JN0698806988eucas1p2h; Mon, 22 Jul 2024 09:35:13 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 43.41.09875.1D72E966; Mon, 22 Jul 2024 10:35:13 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20240722093512eucas1p1f52d83646c27ffbdcb59550c3c751dcb~kf0nghXz03093630936eucas1p1C; Mon, 22 Jul 2024 09:35:12 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20240722093512eusmtrp1901a4a5aed72e38f092ed2bdf173d3f2~kf0nfq47X1407414074eusmtrp1D; Mon, 22 Jul 2024 09:35:12 +0000 (GMT) X-AuditID: cbfec7f4-131ff70000002693-10-669e27d16d9b Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 1D.39.08810.0D72E966; Mon, 22 Jul 2024 10:35:12 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240722093512eusmtip178045709cd5e4d406541eadadb5a983e~kf0nN-Dfa1198511985eusmtip1y; Mon, 22 Jul 2024 09:35:12 +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; Mon, 22 Jul 2024 10:35:11 +0100 Received: from CAMSVWEXC02.scsc.local ([::1]) by CAMSVWEXC02.scsc.local ([fe80::3c08:6c51:fa0a:6384%13]) with mapi id 15.00.1497.012; Mon, 22 Jul 2024 10:35:11 +0100 From: Daniel Gomez To: Ryan Roberts CC: David Hildenbrand , Andrew Morton , Hugh Dickins , Jonathan Corbet , "Matthew Wilcox (Oracle)" , Barry Song , Lance Yang , Baolin Wang , Gavin Shan , Pankaj Raghav , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" Subject: Re: [RFC PATCH v1 0/4] Control folio sizes used for page cache memory Thread-Topic: [RFC PATCH v1 0/4] Control folio sizes used for page cache memory Thread-Index: AQHa2BkH9+ISTh9tgUugWxPZu07/5LH6qAEAgAAEAQCAB8fsAA== Date: Mon, 22 Jul 2024 09:35:11 +0000 Message-ID: In-Reply-To: <99b33a29-e97a-4932-8d7a-85bc01885d18@arm.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.110.32.67] Content-Type: text/plain; charset="us-ascii" Content-ID: <50487096AD92124D8AAA80BBAF19F7A5@scsc.local> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02SbUxTdxTG87/39nLbrMm16nrChgoOyRARdR8uY1vsosnd4hssmmlMXCPX gtKiLXVzmwnRTRhzZJFNoXZaYby066xWyqAdhFXWUgUNbxqYgn1hs4Axa3EKNTDaixvffuec 55znnORQuCQoiKfyVUWcWiUvSCJFRJNr6taanpQLBzJKe5cyeouZZALOb3BmttWFmEB7CWKe WKZxJmhvwpjRUDnBVEc2MF3BMMH02fUkM2yeFTCnHd8jJvJMT24Us+YLZsS26O7HsQarlr3W kMpaTV+RrDV0Jo7trIwQbIs3k60prxCw3UYZ+7htgGTD1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ALSAGQkCBAAA X-CMS-MailID: 20240722093512eucas1p1f52d83646c27ffbdcb59550c3c751dcb X-Msg-Generator: CA X-RootMTR: 20240717104555eucas1p25498323e279fcc42702329d0df60e48a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20240717104555eucas1p25498323e279fcc42702329d0df60e48a References: <20240717071257.4141363-1-ryan.roberts@arm.com> <99b33a29-e97a-4932-8d7a-85bc01885d18@arm.com> X-Stat-Signature: b6z1q7mx69zo4izb3iqngfnp937yjabc X-Rspamd-Queue-Id: 51AC940007 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1721640916-616181 X-HE-Meta: U2FsdGVkX1+zOspnbS5ncDWYYOpuFYMJZIeSNtKlX0YUS/t9DHqB+j38+SPVYzaYuF0H3lYvvJzWEtKy+EwJCH2IJy/6LgtJP84o6YdNIgWh8MrmURcBTm1YJnTUeiRWTXYt8xKCsy0totvgnE8W61yNK8dQM6JenoEW7HDanEZqVZQ+3vpi3eSg0l7hDMoU96tux9hTt6PezQVRaNz2n09LeeVJ+4Cc0EqUM3IFt7dwU9Yg8QvHAwIC0mD3D5iRRrdXTlydxOdOb0D+vdCXq1T1fzRVf8SWqxDbj/3QXUCe4mMnab4Ws8RjLX4lgkTx+W+bVLcXBmyggXlaitod8q9HH4sjenyKgxfu6t7rVx8mb9T55oufAudgH9OLnbvRL+QhO6QdEhGJUaAldN3PMiTeyl/n+H9eOW2TsnDIoUsWRghSkkR6FxioMM6lRAwc7W4456egE8FOEEmN4Uzhi4rsYdH3hPO66CJlI9L/ykEkI5z/gyyKwpKfDPeHFdAmOcvvpJ60YVuwWRE4E7uX+y7y6mA1A8nCtJGVEPqCd+ijS9OlQp3pFSn0ULTGApXsmSEc1DwXHyvD8KgZ3o0BVwECgDo8Re4cfmqAGijC4YG2Bh7+Kj15C8x9WwvSlx/zINGl/1pvb5n9lKGgVnk6aBOlARkycuMMs5LbSKV2CCtuMCoje+GXEJW7NarbFMjKrQ3Bk+UzIKnpTaEa2gRuqzSKfat9DRNmHE5R43CcIdZbGoRabzx6q8GZgUzA6H+Wo//xg/0/4fZPV5Bs1mMAlGserM3+OXp0S/Aedrt8upVZ5ZvLSKwtrSDbtn5uRa9vjqRqV40JAffWM81j4VSEjdbt9Usybg5e4sWBkVL/Ltn6DsWbmEPMuANPVeIaS06mK62SRkFoaWnoTEY65DW1EsoXyxoX+i1E9DXuIsFpbDee2z4u0spYWLgEEwtQBLhqye6ZJ70hN2lLxoG4p1E JMG6e5i+ 5dJsN5sZe1T0w2OcOGf+EchEQlDsr94Xf/aIQKpHpK++hRfD2WnvfId7NfBUO3u7f85O18GkjRhPCX5orgE26TvobrGg3NLSJ4xafJ8lqn01XppB2//SvAP6aYIgdMjs/2RJ5WqiLW1SCUABQMO3Z6LIhe9F9LPV8SuMsczpujKCwgD/5EaD5ItMHMfm1d75bxxXu 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 Wed, Jul 17, 2024 at 11:45:48AM GMT, Ryan Roberts wrote: > On 17/07/2024 11:31, David Hildenbrand wrote: > > On 17.07.24 09:12, Ryan Roberts wrote: > >> Hi All, > >> > >> This series is an RFC that adds sysfs and kernel cmdline controls to c= onfigure > >> the set of allowed large folio sizes that can be used when allocating > >> file-memory for the page cache. As part of the control mechanism, it p= rovides > >> for a special-case "preferred folio size for executable mappings" mark= er. > >> > >> I'm trying to solve 2 separate problems with this series: > >> > >> 1. Reduce pressure in iTLB and improve performance on arm64: This is a= modified > >> approach for the change at [1]. Instead of hardcoding the preferred ex= ecutable > >> folio size into the arch, user space can now select it. This decouples= the arch > >> code and also makes the mechanism more generic; it can be bypassed (th= e default) > >> or any folio size can be set. For my use case, 64K is preferred, but I= 've also > >> heard from Willy of a use case where putting all text into 2M PMD-size= d folios > >> is preferred. This approach avoids the need for synchonous MADV_COLLAP= SE (and > >> therefore faulting in all text ahead of time) to achieve that. > >> > >> 2. Reduce memory fragmentation in systems under high memory pressure (= e.g. > >> Android): The theory goes that if all folios are 64K, then failure to = allocate a > >> 64K folio should become unlikely. But if the page cache is allocating = lots of > >> different orders, with most allocations having an order below 64K (as = is the > >> case today) then ability to allocate 64K folios diminishes. By providi= ng control > >> over the allowed set of folio sizes, we can tune to avoid crucial 64K = folio > >> allocation failure. Additionally I've heard (second hand) of the need = to disable > >> large folios in the page cache entirely due to latency concerns in som= e > >> settings. These controls allow all of this without kernel changes. > >> > >> The value of (1) is clear and the performance improvements are documen= ted in > >> patch 2. I don't yet have any data demonstrating the theory for (2) si= nce I > >> can't reproduce the setup that Barry had at [2]. But my view is that b= y adding > >> these controls we will enable the community to explore further, in the= same way > >> that the anon mTHP controls helped harden the understanding for anonym= ous > >> memory. > >> > >> --- > >=20 > > How would this interact with other requirements we get from the filesys= tem (for > > example, because of the device) [1]. > >=20 > > Assuming a device has a filesystem has a min order of X, but we disable= anything > >>=3D X, how would we combine that configuration/information? >=20 > Currently order-0 is implicitly the "always-on" fallback order. My thinki= ng was > that with [1], the specified min order just becomes that "always-on" fall= back order. >=20 > Today: >=20 > orders =3D file_orders_always() | BIT(0); >=20 > Tomorrow: >=20 > orders =3D (file_orders_always() & ~(BIT(min_order) - 1)) | BIT(min_ord= er); >=20 > That does mean that in this case, a user-disabled order could still be us= ed. So > the controls are really hints rather than definitive commands. In the scenario where a min order is not enabled in hugepages-kB/ file_enabled, will the user still be allowed to automatically mkfs/mount wi= th blocksize=3Dmin_order, and will sysfs reflect this? Or, since it's a hint, = will it remain hidden but still allow mkfs/mount to proceed? >=20 >=20 > >=20 > >=20 > > [1] > > https://lore.kernel.org/all/20240715094457.452836-2-kernel@pankajraghav= .com/T/#u > >=20 > =