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 E4BBAC61DA4 for ; Wed, 22 Feb 2023 23:55:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 491536B0071; Wed, 22 Feb 2023 18:55:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 441AE6B0072; Wed, 22 Feb 2023 18:55:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 309876B0073; Wed, 22 Feb 2023 18:55:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1C0996B0071 for ; Wed, 22 Feb 2023 18:55:59 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id DC566405A4 for ; Wed, 22 Feb 2023 23:55:58 +0000 (UTC) X-FDA: 80496588396.25.8CFC9A7 Received: from mail-vs1-f51.google.com (mail-vs1-f51.google.com [209.85.217.51]) by imf01.hostedemail.com (Postfix) with ESMTP id 3EA1D40004 for ; Wed, 22 Feb 2023 23:55:57 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ncnlKBN+; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf01.hostedemail.com: domain of yuzhao@google.com designates 209.85.217.51 as permitted sender) smtp.mailfrom=yuzhao@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677110157; 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: references:dkim-signature; bh=tyCckubHCcKhIdYAMZQ+JXf8fJjXutziNHzKZz1NnVA=; b=wFpEqkE1zR7uIHqKll6txVvqyWkGTDXj6I2hOOAruGHjTohlQr56kasDy3qjUd+6jWCnRo ApKVP/z1+gC7+CvCI/IGXnz+PT64uBRERV2In2lGq/aVPA3usy1+t7rZ1K18rHCRucEpED 2fJ4D8CWYgh2BFrBnW4zzJ325c6E1vQ= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ncnlKBN+; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf01.hostedemail.com: domain of yuzhao@google.com designates 209.85.217.51 as permitted sender) smtp.mailfrom=yuzhao@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677110157; a=rsa-sha256; cv=none; b=WFIJPy+SgUXoMEi4jTiK5y3tKf9RT6cBUg5Tn/qOM/lM//aTV76mxksPIxcTGqgIaoMAb8 veTaxSYw8D7C966ius08GhJJ9pAUG2Fo4EcsoU4yPb9LngwtooWGHtEf4OdJppPzlYqrYj ksOS/0SOME2/7oBsIRljzdO7hnsq98w= Received: by mail-vs1-f51.google.com with SMTP id d7so6413780vsj.2 for ; Wed, 22 Feb 2023 15:55:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=tyCckubHCcKhIdYAMZQ+JXf8fJjXutziNHzKZz1NnVA=; b=ncnlKBN+dagkHyEvaj8i47pWbUgepj33a+LsWOSUupsNIqNmexNJl1Bw6ONZ9c+94f vXYPGvyRlAalYGPNzrCEJTPNGSVY91NeWI3im4Pw+gvO6s8SfnITGw/avWOyWvyM7fcC HlmxNpEP6Chf0JuHmvueUpcB5M54i6GTA01aIq/hbldXZRhZsVaqi6khdhVpmOh33b9U gAgjCnM3E1MNAE5lgqBjmEBI/m4KiapjIgebFxUJJWGyQv07rtrRMHxJT2/mXTKRT1kX bAzSiHm5GXMGFBbC9MKAZdpKo1ye7LtJ8JZ2e5pDtcQFERYRqVc8Dw4L4by0ZRuh7Zgp 5IHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=tyCckubHCcKhIdYAMZQ+JXf8fJjXutziNHzKZz1NnVA=; b=e0LgIcV2ii7c0xNOjSSqk4zDgam75nGK6VbcJb9965AYc3RlYAkNPxAxsv/4OWPE5b aNwakJUxd6hDth4UEsOCZFe4HeLOW2FGkPbGZJQ0UWEMHVA98Se8+3GXpVJ628Tz99Jv QG3RusXJAGDaNVVb/VIjGw78rF6gpVkJ+Ka0OiSJDpppyUVoe9hvD87dsTq4w0/tI0V3 9U8/ENVEucXTWDl0p46NlcTLB5FNSaduLgiluXBPIskRrkaGWi5d4ZJ9uplIejDoMW5M L2F1zDqbh7wnZFmhx89zPbeQKcr84vBZ8vb5FZEoQR8nLgKcrXL19QzZ27fReE0CCFdO 1Kdg== X-Gm-Message-State: AO0yUKU5LgYbucSNI9NvJn4/nMWvZ0j2UJ/1Ow04kD5Yr+7hkPkA7G+m TMGlyb+AOdowVavZTatlyVIV8k7XuGIvhzdx82Y/XQ== X-Google-Smtp-Source: AK7set8iIrh8g2f5ja1yFWX47em0P70deJQ/G280hpys4LuT9Zh4Cumb5/nSwlGy1KdMkIIV1ntgPZuUkiq3kj59D7w= X-Received: by 2002:a05:6102:108f:b0:41e:d8b5:ee40 with SMTP id s15-20020a056102108f00b0041ed8b5ee40mr418818vsr.26.1677110156124; Wed, 22 Feb 2023 15:55:56 -0800 (PST) MIME-Version: 1.0 From: Yu Zhao Date: Wed, 22 Feb 2023 16:55:20 -0700 Message-ID: Subject: [LSF/MM/BPF TOPIC] Flexible orders for anonymous folios To: lsf-pc@lists.linux-foundation.org Cc: Linux-MM , Yang Shi , Matthew Wilcox , "Yin, Fengwei" , Hugh Dickins , "Kirill A . Shutemov" Content-Type: text/plain; charset="UTF-8" X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3EA1D40004 X-Stat-Signature: cgpbwka88yefpbokdbjddnefgupa1sj5 X-HE-Tag: 1677110157-936709 X-HE-Meta: U2FsdGVkX1/j9eeAWsPsTfbt/8unyOIiYdGgrxGb/KTOKorOvL3KmErhVW4VnzFMRiWC9munwZMvXfQSoq8Jnt3TePh8EPDNTpW+m2B2r/PmaebzgsRUo+9ah9g0MKkQ2AoWDHZOg3sjIGQAqTP3W3n9HGo6CQOnomNA1pDMPo4O9o10glC1guHdj0qOxeXzCA9/5J5OxhRoFz9eydO59SBxP1Y4DngvzLsUd5Y0vxiUI6JYPzM0TgLz7dbMfSeOCYNk/jM1snfReHx4sY1Kpokxa9byESjFtPR3UR0Ic27Egrm2RxgRPi0HGAmy9y4nYcv8CY160tLqh8+xzHkxttK8ur/ZjWDXGgm0aBgqf3F1l2/yn4edCbr2mJ1j73AivCBKxIU6vb4EPSY9zXI5KN4afBdvVouVsmxtidktqMQBxCwTHPatP4pIBiZHSPOIFwT9i1fZWs5Q+rn1YCXt33WdcNeLF3iqE18sBZJjzdVwUpfrG56k8kjHVxS/2XsMfM0eMmJFQ8IdgiW0aYslu5YmriKo+0X9ygcIPBIU/MFFRLHOI7RVnwkX4/Vu5dkYZfHQckVbv4IvNvzTYrng2wYSld05dUKxAgpLpUjXg+1Rz1n5l5i64gfoEKSK2Ndoa5329gxHAJlgI+pyDm+FV6faAt30iaocuUemzRVu7yfj1RrsWLpR2p8YDa2w9wLhGGsa1CO6rNje8JPgVsIWsbIigZNFi9RWWKbEtIEcqlgfHSpExItMzm5++0bpHy5Swrc63z8gNuid+tDr8yE/bv9CiF76xHyo/VDHXY9+la1nZAOLqbAOKbJfck/rVOzmEfAdkHd95djrwmtbBB1MPjN0Cu+VfYFZF66spHlegqxrI9mY1w0z8YqzVRPcePNTfOK1xPy4bG66JXBJXjzAwYRAmEUcXUd5kKDefYHWCvkF8a3M7pvxeqaY88qjld5b0awAOVz1BLeNkKAdBka zvKYG8Mj mGV6ZT9NTONiW4qFuYUn6wc/9dHNxyMRxCjSAzQ0CVrc2q78Y9qzL+TnrD+gtTRY0QxGm26gW9zEKwMNYHXTXGO+mSj7t15ZzpYAka77+xFrulkkV7q47KgrKttU3ItxXLinYFRunWVgS8teZvK7A8jemFvRcAGez1HCIR6lw8CBvmCZ/UgARGh7nGrkHy0r9U3xN+Mxi7FBR9kryf40f/QjEN/HygaK4SMgtJry9BeNaFFuddTPGRP8HX454WdIWVKjhsXD5UjFL6ucrIrJcOUXH4rJ0EtlIPhcOVVnF6Bju+hYaW253giLo8EY8op1fpHOFy3xBGZLKWTSjBk1cusFlRDO8FjQ5bvr4326gtLUechU= 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: 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. A bit of history: I discussed this topic at Matthew's THP Cabal meeting a couple of years ago, as one of the major use cases of folios. Around the same time, I tried to get Hugh to work with me on it, since he tried something similar back in 2001 [1]. William's page clustering from 2003 [2] is also based on that, btw. Then I put the idea on the back burner. 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. [1] https://lore.kernel.org/linux-mm/Pine.LNX.4.21.0107051737340.1577-100000@localhost.localdomain/ [2] https://lwn.net/Articles/23785/