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 D5788C636D7 for ; Thu, 23 Feb 2023 04:01:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2CA936B0072; Wed, 22 Feb 2023 23:01:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 27B236B0073; Wed, 22 Feb 2023 23:01:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 143576B0074; Wed, 22 Feb 2023 23:01:39 -0500 (EST) 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 EC2436B0072 for ; Wed, 22 Feb 2023 23:01:38 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B96DD4102F for ; Thu, 23 Feb 2023 04:01:38 +0000 (UTC) X-FDA: 80497207476.05.3F9161A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf02.hostedemail.com (Postfix) with ESMTP id 9055780004 for ; Thu, 23 Feb 2023 04:01:36 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=bT20GxoC; dmarc=none; spf=none (imf02.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677124897; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=G1uyBHBr0exTyDpIEToLw6YmnB/MalwVCvO0Migs2JQ=; b=DBnplTosQvUVhqHPBdShczrtzWc8NKuxWuynRPouCtjTxshpCjY5Sfg2oTu2ODvEV2CX/g eDUipMTlYa6mwKFatUUOxNyNKMux74QBcl6+hZ2ewN5ssTuKh3/iAO3ikvZPTaT7/0vP+S L90TrrVu/dA/qq5Q5YqOzKL62Td46+8= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=bT20GxoC; dmarc=none; spf=none (imf02.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677124897; a=rsa-sha256; cv=none; b=KvMpvtHV0pdL3z31+rpU6yWiVsnWUPhZQfl8RSuMEp+800S6cPetxj2sJ6zNus1SVtPjja D9CyDlneme+aUzBXkkXSWm6mWT7Tzvl4xiO+rDbkGcgsURpxlLAnKzeW2iRaY/c9noZyxw xiLtCrDZMzA36ZBemClwxNcZ5UyGBgo= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=G1uyBHBr0exTyDpIEToLw6YmnB/MalwVCvO0Migs2JQ=; b=bT20GxoCNsGFwlOwKHqr8QbpG0 XZrMGE7wCkT/kw4c8ZnhDE+2xw05DrVpHwnRRjGyR9CraT67l+O6q159mAe+N7p5I7EcjV52pX/Bh uYJxx2vUdzxrrdu/I87ecxnc887f8JKHtO7uC4uvZygyiDTtskx8ODp12/P6EKTQEjixirouyJ7fo cYVdVJKr8eWN3yAovX9fthDsrhMe1TeGmqdY4Tt4pqMZJx/xvOjt544QtaJbdSaZZnc5aexJigpv9 gbXbOfKKIgZGmJgDanuTOG0dRcY3Q+8TfbHERhiqxk67C41+QT/+xWpXTojWw3g+U47AeMk6tG++N tC0MD3lA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pV2nP-00E2pK-Rx; Thu, 23 Feb 2023 04:01:27 +0000 Date: Thu, 23 Feb 2023 04:01:27 +0000 From: Matthew Wilcox To: Yu Zhao Cc: lsf-pc@lists.linux-foundation.org, Linux-MM , Yang Shi , "Yin, Fengwei" , Hugh Dickins , "Kirill A . Shutemov" Subject: Re: [LSF/MM/BPF TOPIC] Flexible orders for anonymous folios Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 9055780004 X-Stat-Signature: e7ois3z77u9wq7jjiaa75w7ra53bgatz X-HE-Tag: 1677124896-617292 X-HE-Meta: U2FsdGVkX19nONCJ+8kVwrB8MsLpbBxQzf4tIbPM2sQJDuXRyedFSK/6XoixiTORtq9k+gwcI6tbGpLAD2qvHf7p06pyW2Ak54Mm3PLyysfJDp+Sf0S6axitwdI/JfHez3OBP/IhqoRHyHTdUo49DDiAmDWYRbhP8BamY5/1vZiNDJ63eKxuH4sqppEhGNLdF3H1WBbThVIFxeEfQWQ0+FZSHeSvP0Yo2pSKTRdt6IE87cY4811DOe7VpiC4Zb6SDJpqTs/LWqdfYxZRsjdY2fQ2ZJDtO4hjEznt4Qd/+NlMK6R4ZngJvdXJ5PX3auYvH2bLQKAeHRkQRRlVBY7YLWrWg0qSZWoHz2uzgKSfqEH/n9Wpa0SeHRhhGtZkaQ+YD+g3zU2a5nuORFfvi/Jy1mApgFMzhsSAF8Ow9uPdTYKxmUN++qv6N43RtAaqGJ/2qO1iMVhQFYdYODPBCDYLnQVzSJl2kjYF25v5CZJJMDsWVUv8CiY9mH7fyL2nYkljd2nEkrrbU+TQRCZSnAONTXT97aUDf5mOrJAp/L4E7OK3KUAoi24P2KTNwc3+wZDgFF8oboXCqXZHDFeNxjCsFn2BA9Fxm62t7HL6rJnfe/snlfH2zF3oiR5Owak8G5Nw9W9S3e5mZcPkehB+g/gM7Zb3XoDOzO3PU15wjlkiSTp7YaWNJTL0IENXuOE8ZJTWqGslbJuwGx8VjYudBaBAZh7C5c9NT0liWR8yAlaCknKLF1mIbOome7J+cbxK2mkqtSRXbMBXKKkS8gbBnLF557kk/5aW1urZJQbEMuxq02A5//SKglSQSU7mxAKz5kDx5fJrfzTVvZifI2nNRKs9iGfxsiI34zzjYat+dnuEMQ9+gxfMOltpnafn+wuhMdTLrv16jOTWLfbJ8v+zgxu9x8h7mug0RJmEJv2h7Gree9sfhagR1RyQH44vUTII1beS0rgtt+y++OEKguwqBY/ cC6mpvmO 0DscD3hudHcd0NR3JHvUpR8jELq88xzcsObwRSQiTWS3FSkJvkjHIq6qQQd/OuR8AC5jJHZWnrPz4MjxM+E25P64E7to82IbZrVcMtXFkGphv91TCouyl0ojjze/sI5TgjjPAnwKyl9pyxqmTCnQBnk/owvoacsCRkaWSFs1CXxlEt8wGdqbSOFUciVa0oTSnjJU0UFQrptMjAQm/ZZsHIj2ObsYzGiA0i7neRbd34EsLcns0mNvGraNTQ9PLaXI2EffdZR/7bIWOBVsj5CeZkdYL+MrqlbdP158wm/c47B6ME42OFkhe/37i4rxZCFc1VYJOfsA9aRYSBBu6akV/hj0u5Qh7tJB8hrz3 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: On Wed, Feb 22, 2023 at 04:55:20PM -0700, Yu Zhao wrote: > Currently anonymous folios only support two orders: 0 and the PMD > order. Flexible orders for anonymous folios can resist both internal > or external fragmentations when the PMD order is too underutilized or > costly to allocate. Flexible orders can also leverage the TLB > coalescing feature, .e.g., order 3 for AMD and order 4 for ARM CPUs. > > Discussion points: > 1. The page fault path: determining the best order and the fallback policy. > 2. The reclaim path: detecting the utilization and the splitting policy. > 3. The refcount and the mapcount models, e.g., reuse the PMD-mapped > THP model or not. > 4. The splitting, and the collapsing if needed. > 5. Other paths: COW, GUP, madvise(), mprotect(), page migration, etc. 6. Swap out an entire folio instead of splitting it before swap. 7. At some point we're going to want Zi Yan's patches to split a folio into arbitrary order folios instead of just to order-0. 8. For file folios, folio->index % folio->nr_pages is 0. Do we want to maintain that invariant for anon folios? It helps tile the folios so we don't end up with say, order-0, order-4, order-2 folios in a sequence. 9. How do we ensure that two page faults do not overwrite each others folios, eg PF1 decides to allocate an order-0 folio at index 6 and PF2 decides to allocate an order-2 folio at index 4? Probably some other things left to decide. > Now it seems to be a good time to revisit. Yang Shi and I have been > looking at some details, trying to scope out the work that would be > required. We don't have anything definitive yet, but we should have > enough to share by the time of the LSF/MM/BPF. Excellent. There are other people also interested in this. eg: Ryan Roberts: https://lore.kernel.org/linux-mm/4c991dcb-c5bb-86bb-5a29-05df24429607@arm.com/ Fengwei Yin: https://lore.kernel.org/linux-mm/20230109072232.2398464-1-fengwei.yin@intel.com/ Obviously I'm keenly interested. https://lore.kernel.org/linux-mm/Y%2FU8bQd15aUO97vS@casper.infradead.org/ This is definitely worth its own session in the MM track.