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 6C505EB64D9 for ; Fri, 7 Jul 2023 13:24:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CEC1D8D0001; Fri, 7 Jul 2023 09:24:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C9C786B007B; Fri, 7 Jul 2023 09:24:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3CA38D0001; Fri, 7 Jul 2023 09:24:41 -0400 (EDT) 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 A3E4B6B0078 for ; Fri, 7 Jul 2023 09:24:41 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5B4E840D3F for ; Fri, 7 Jul 2023 13:24:41 +0000 (UTC) X-FDA: 80984885562.22.178E87B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf05.hostedemail.com (Postfix) with ESMTP id 044A610000B for ; Fri, 7 Jul 2023 13:24:38 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=c0l+D2V7; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688736279; 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=VEFcRoCoXVLK+7VFfisj/fbzvaM26gsp7BfC99uuIKI=; b=uP+HJfzd5HpThCeJ2vDoxbFDVwUogDvtNCOKxjv0fNXFgFNg6cMQ1YIXf9x5JJkhrHSKXX PDkt652eZqMFzaa8un7M1t+G8LrMTZ699wxnTRHH2WYhIJW60vq8r5HyaexRq7n/TJFqYM N5P3i7PwHfGug2caWxcW6MLYjx0dw8c= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=c0l+D2V7; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf05.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688736279; a=rsa-sha256; cv=none; b=cyJ6/fROqFDVWQVRSAcnvSIcDH580txBhEULb+gMLMNzZ6uohY4+Su/fSmiRHr9MUZafIu fFg5JCcQm4QTTfISLeLwIAZgNtFkmxUbyT/5B/rfe3HZllvnGaxd/8T0oO5gq91D3QrIU4 sJxrNif/TOMArTxWH847Rwn/48mTGEs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688736278; h=from:from: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; bh=VEFcRoCoXVLK+7VFfisj/fbzvaM26gsp7BfC99uuIKI=; b=c0l+D2V7deAe1B96RG+7qwxo2+P9ldiUhtSDGiSSgcw5eWws7FSJvba6viQFYFcGX7OviA gK/6As08bM1FCLojIZNsHVGKjFg5brF4DiUPzemRguA63illsVcDjDcURkNT2UowFB6eDo xRzEmPe8Ll029nXR6YAMr3oOg6t3FX8= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-70-1b0UTUBQN7GtpeIw1CcHOA-1; Fri, 07 Jul 2023 09:24:36 -0400 X-MC-Unique: 1b0UTUBQN7GtpeIw1CcHOA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3fbffd088a9so3103775e9.1 for ; Fri, 07 Jul 2023 06:24:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688736275; x=1691328275; h=content-transfer-encoding:in-reply-to:subject:organization:from :references:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VEFcRoCoXVLK+7VFfisj/fbzvaM26gsp7BfC99uuIKI=; b=MU3BVbjbi7YVsvkqYuOHwss5zYv6uDazCC/Su7XJ4GcR6cKmEblwUQ9WN6qnuvYCZp DKaz421dcmahMfj2YHa7S8lgHUWXG7S5O/7/w64+dik8FXhlqPj0nMf+P2cdUOIoeT7s PIeNSdRgfbnwgKNK86gIJjhSrl9+7PTKfggbc0lgMPmY6S/Mi/vi6DBnYpNHg/0Q4LDQ z8Ft9Dyztq9LpeMYe268T5hE95SsvqYdVxMSO2TQ3p/v53JOrqe1bTRR6M3af349oCR2 BfIuz3HAtrGoCWAIuPp5jSq9EEd/8aWOBL7JksRkwxUqJqzp3SyAyzJJSLbtL2+dXddS qE2Q== X-Gm-Message-State: ABy/qLazxgaA4NZ2XWErOGK/AlXg57nk58h42yYNPU8Lg/TzVFJfzaSf PamLFn4MrBEIBdCfI0bYA4iUK3RY6rN3Ica839Pv45siUN2IedApF0YN+7AFPtS6jV5yd8VaJVK 8VcTR9Pta/Lw= X-Received: by 2002:a1c:7207:0:b0:3f9:ba2:5d19 with SMTP id n7-20020a1c7207000000b003f90ba25d19mr2895771wmc.33.1688736275643; Fri, 07 Jul 2023 06:24:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlGFVvL9q8yYSppFfRa1HCdHsC+rutktlC8PQkloBmNP9FEN51xRbZjnrVds18S/8Ffgzq8L4Q== X-Received: by 2002:a1c:7207:0:b0:3f9:ba2:5d19 with SMTP id n7-20020a1c7207000000b003f90ba25d19mr2895750wmc.33.1688736275295; Fri, 07 Jul 2023 06:24:35 -0700 (PDT) Received: from ?IPV6:2003:d8:2f04:3c00:248f:bf5b:b03e:aac7? (p200300d82f043c00248fbf5bb03eaac7.dip0.t-ipconnect.de. [2003:d8:2f04:3c00:248f:bf5b:b03e:aac7]) by smtp.gmail.com with ESMTPSA id s8-20020a7bc388000000b003fbfc61d36asm2396655wmj.5.2023.07.07.06.24.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Jul 2023 06:24:34 -0700 (PDT) Message-ID: Date: Fri, 7 Jul 2023 15:24:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 To: Matthew Wilcox Cc: Ryan Roberts , Andrew Morton , "Kirill A. Shutemov" , Yin Fengwei , Yu Zhao , Catalin Marinas , Will Deacon , Anshuman Khandual , Yang Shi , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20230703135330.1865927-1-ryan.roberts@arm.com> <78159ed0-a233-9afb-712f-2df1a4858b22@redhat.com> <4d4c45a2-0037-71de-b182-f516fee07e67@arm.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v2 0/5] variable-order, large folios for anonymous memory In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 044A610000B X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 7zdaw3yty7g3h5m1s3hkqceu7pt3kujk X-HE-Tag: 1688736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x6dqxqltlKj+dOH0RAwKkGrgmGsAndMnciVb+oA2/pawrq1vDNBhtB5QmorzYiuaE9w2oK2wyiH9TBpnlwOSqRY+H+opdChOQ/140PRCJ98oRCwVIV9WeuSwV6g/dUimfAnRFCJZxEK3MgZhtIkEDC7DszsEh7LkdJvwmEEMw6EqrfycNjjpfvzGfmTzL08Iv0v49cnuYtgvaL7ABpBJM8Oi3Dd 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 07.07.23 15:12, Matthew Wilcox wrote: > On Fri, Jul 07, 2023 at 01:40:53PM +0200, David Hildenbrand wrote: >> On 06.07.23 10:02, Ryan Roberts wrote: >> But can you comment on the page migration part (IOW did you try it already)? >> >> For example, memory hotunplug, CMA, MCE handling, compaction all rely on >> page migration of something that was allocated using GFP_MOVABLE to actually >> work. >> >> Compaction seems to skip any higher-order folios, but the question is if the >> udnerlying migration itself works. >> >> If it already works: great! If not, this really has to be tackled early, >> because otherwise we'll be breaking the GFP_MOVABLE semantics. > > I have looked at this a bit. _Migration_ should be fine. _Compaction_ > is not. Thanks! Very nice if at least ordinary migration works. > > If you look at a function like folio_migrate_mapping(), it all seems > appropriately folio-ised. There might be something in there that is > slightly wrong, but that would just be a bug to fix, not a huge > architectural problem. > > The problem comes in the callers of migrate_pages(). They pass a > new_folio_t callback. alloc_migration_target() is the usual one passed > and as far as I can tell is fine. I've seen no problems reported with it. > > compaction_alloc() is a disaster, and I don't know how to fix it. > The compaction code has its own allocator which is populated with order-0 > folios. How it populates that freelist is awful ... see split_map_pages() Yeah, all that code was written under the assumption that we're moving order-0 pages (which is what the anon+pagecache pages part). From what I recall, we're allocating order-0 pages from the high memory addresses, so we can migrate from low memory addresses, effectively freeing up low memory addresses and filling high memory addresses. Adjusting that will be ... interesting. Instead of allocating order-0 pages from high addresses, we might want to allocate "as large as possible" ("grab what we can") from high addresses and then have our own kind of buddy for allocating from that pool a compaction destination page, depending on our source page. Nasty. What should always work is the split->migrate. But that's definitely not what we want in many cases. > >> Is swapping working as expected? zswap? > > Suboptimally. Swap will split folios in order to swap them. Somebody > needs to fix that, but it should work. Good! It would be great to have some kind of a feature matrix that tells us what works perfectly, sub-optimally, barely, not at all (and what has not been tested). Maybe (likely!) we'll also find things that are sub-optimal for ordinary THP (like swapping, not even sure about). I suspect that KSM should work mostly fine with flexible-thp. When deduplciating, we'll simply split the compound page and proceed as expected. But might be worth testing as well. -- Cheers, David / dhildenb