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 8A6E1C67861 for ; Fri, 5 Apr 2024 10:38:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 19C8A6B00C5; Fri, 5 Apr 2024 06:38:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 14E486B00C9; Fri, 5 Apr 2024 06:38:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE1126B00C7; Fri, 5 Apr 2024 06:38:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D35B16B00BE for ; Fri, 5 Apr 2024 06:38:19 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 883FEA1866 for ; Fri, 5 Apr 2024 10:38:19 +0000 (UTC) X-FDA: 81975128718.04.FE28BB3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 4FF404000F for ; Fri, 5 Apr 2024 10:38:16 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Q5eaBUOx; spf=pass (imf04.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712313496; 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=I0L4+tioaEa5Oez9lF/k2qN4oyGOYvytJdtMM+KNXgo=; b=vnh3TFdDz25bARgLz/zYrAQV94C449e6lwx1wlipGLpuiULtOAAXq0rQNqU7VMorR90TWF oMVcktp7LKHSaozg6cNt3cAcBaNvABSxo4QCph7mbkyxPtF9EHI+gdlYt0JPalktck6jNj bMuby+Z0m1yBX1DsCT0xL/2yRt/ojJE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712313496; a=rsa-sha256; cv=none; b=s0m84qC5ebdNQ1xGHciNddKy/tzx0nEVNrxt5AHlN1IZY3Exxok3LFkm2Ucrf7rR4OdL/S 806UN6EkHDjOnDKXzlgEtHERhr3+gnpQRLINJZl+Fe/7NDeT9UrkoSDiHwJRaSeZ9dfdJs WWNVA0AvclMyOSUC9vzrD6d6ISrU6i4= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Q5eaBUOx; spf=pass (imf04.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712313495; 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:autocrypt:autocrypt; bh=I0L4+tioaEa5Oez9lF/k2qN4oyGOYvytJdtMM+KNXgo=; b=Q5eaBUOxMIxm17dDUwMLpZ47/bfp58pV47+JCbiI+kVFPUnqeU7SB0z59zXoK2Aln82NZS nKlWJg4zc9zECe8b34wkQ+GJsSo7Efal41oJ1f6Mrfqc6EKRjLOJd0sOVcTj3/JrRcuOMS +/XklZTaUtCFAqtQIrGzbpFCLjh+uvs= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-27-ZJ49YTuwPl6opEKa6ExX8A-1; Fri, 05 Apr 2024 06:38:14 -0400 X-MC-Unique: ZJ49YTuwPl6opEKa6ExX8A-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-343d3e1ff1eso739483f8f.3 for ; Fri, 05 Apr 2024 03:38:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712313493; x=1712918293; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=I0L4+tioaEa5Oez9lF/k2qN4oyGOYvytJdtMM+KNXgo=; b=P/xlFRqxZOw6BedJq2cTe5Xhb0UAdUI4cZ25DYurrNNDmBnoj4Iumwl9EtmkGyUot5 8e9aRUISM45FhTsSFczARytz/e6VRKAHro6TRmPBkSJXwKPV2LJe05fx0tGlYflTJkBQ /gm7PqCrma6h0dF03wb1kA1mDiNbCH+iZypiO9erFtzKQ6N1HjDv1vr7AaEg8l71dHay +sqjr4KD9/uwPuyFHVyT5YVIpErq07ZY3C8rhmN3AIMUZ60qzIIeKqAvH1KtMD1AqKUQ l+7TsGtnu0rJeSRemk3sNeiwg5eyci47DaIk/gzwMl6D+iGsfsf8RSal/zAPmzzswB3I xspA== X-Gm-Message-State: AOJu0YyMHYjZ3D2kAXEarONFql4aKnSUtk1t6nFpf4qYn/dWvflD5cdY uPtd01jzRygCIXV8JhuQN6cW6sXnflHBmRsUcSGQi2IKU4ue65ALUJhHnMuNfeAcm/SwXtPvATf kE5ie9jQpmEABR47ZGNmAMwrnSJoYtGMOrZ3PAEAnPB5j2ot6 X-Received: by 2002:a05:6000:dcd:b0:33e:777c:3899 with SMTP id dw13-20020a0560000dcd00b0033e777c3899mr883771wrb.38.1712313493163; Fri, 05 Apr 2024 03:38:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHyfFTD3zwItr6aj2WiOUXsHcvRA8x7JictPcRE/VUTmPyzHDisD8P+Z29Zc6RCleXwMuNGaA== X-Received: by 2002:a05:6000:dcd:b0:33e:777c:3899 with SMTP id dw13-20020a0560000dcd00b0033e777c3899mr883757wrb.38.1712313492634; Fri, 05 Apr 2024 03:38:12 -0700 (PDT) Received: from ?IPV6:2003:cb:c74b:5500:e1f8:a310:8fa3:4ec1? (p200300cbc74b5500e1f8a3108fa34ec1.dip0.t-ipconnect.de. [2003:cb:c74b:5500:e1f8:a310:8fa3:4ec1]) by smtp.gmail.com with ESMTPSA id f13-20020a5d64cd000000b00343e97150d6sm1149011wri.32.2024.04.05.03.38.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Apr 2024 03:38:11 -0700 (PDT) Message-ID: Date: Fri, 5 Apr 2024 12:38:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 4/6] mm: swap: Allow storage of all mTHP orders To: Ryan Roberts , Andrew Morton , Matthew Wilcox , Huang Ying , Gao Xiang , Yu Zhao , Yang Shi , Michal Hocko , Kefeng Wang , Barry Song <21cnbao@gmail.com>, Chris Li , Lance Yang Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240403114032.1162100-1-ryan.roberts@arm.com> <20240403114032.1162100-5-ryan.roberts@arm.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0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RBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq 3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <20240403114032.1162100-5-ryan.roberts@arm.com> 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-Stat-Signature: wm7m8n9ks5di57orspjwrhr6mzrz3qeh X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 4FF404000F X-Rspam-User: X-HE-Tag: 1712313496-579985 X-HE-Meta: U2FsdGVkX1+fcxxP+L07ZclKcEEqXDh7dcBVCf+k4IB8BhhcnRuIIJf97JFovdTvVLAdeMTxH6yMotBvZtdwf3eGrs5SQIPwfh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HMfQHiIbi5vEKVYplo9a703SY8pVgrF/9p8EimIYP+o61f96AsWB54s6l1arnDa8MCLO3GaD1ocPWbY6sEyPHKtECTFKkg/SpNCO5fuhrKZn/WXgE1r/fmbXm9D6UaawUGCIgeeIsK8FqsgUgZTO48Alhd6Aa0JxkFMwluQC9Qaejq17GHBaa8ET+604eUeBsO78gY+0BHPQSLXIlrDa8VgotVC1kcrqhJyRwSHmrbQBFx1E4gixcZqUM6Ek+aluwIzQlGzS8AbRmowPB5FguS0a7ROZ/Tw+n0WfSpIuaZ4BU/sxeDDrmxy+yWHMAjAD9mDwsG778F 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 03.04.24 13:40, Ryan Roberts wrote: > Multi-size THP enables performance improvements by allocating large, > pte-mapped folios for anonymous memory. However I've observed that on an > arm64 system running a parallel workload (e.g. kernel compilation) > across many cores, under high memory pressure, the speed regresses. This > is due to bottlenecking on the increased number of TLBIs added due to > all the extra folio splitting when the large folios are swapped out. > > Therefore, solve this regression by adding support for swapping out mTHP > without needing to split the folio, just like is already done for > PMD-sized THP. This change only applies when CONFIG_THP_SWAP is enabled, > and when the swap backing store is a non-rotating block device. These > are the same constraints as for the existing PMD-sized THP swap-out > support. > > Note that no attempt is made to swap-in (m)THP here - this is still done > page-by-page, like for PMD-sized THP. But swapping-out mTHP is a > prerequisite for swapping-in mTHP. > > The main change here is to improve the swap entry allocator so that it > can allocate any power-of-2 number of contiguous entries between [1, (1 > << PMD_ORDER)]. This is done by allocating a cluster for each distinct > order and allocating sequentially from it until the cluster is full. > This ensures that we don't need to search the map and we get no > fragmentation due to alignment padding for different orders in the > cluster. If there is no current cluster for a given order, we attempt to > allocate a free cluster from the list. If there are no free clusters, we > fail the allocation and the caller can fall back to splitting the folio > and allocates individual entries (as per existing PMD-sized THP > fallback). > > The per-order current clusters are maintained per-cpu using the existing > infrastructure. This is done to avoid interleving pages from different > tasks, which would prevent IO being batched. This is already done for > the order-0 allocations so we follow the same pattern. > > As is done for order-0 per-cpu clusters, the scanner now can steal > order-0 entries from any per-cpu-per-order reserved cluster. This > ensures that when the swap file is getting full, space doesn't get tied > up in the per-cpu reserves. > > This change only modifies swap to be able to accept any order mTHP. It > doesn't change the callers to elide doing the actual split. That will be > done in separate changes. > > Reviewed-by: "Huang, Ying" > Signed-off-by: Ryan Roberts > --- > include/linux/swap.h | 10 ++- > mm/swap_slots.c | 6 +- > mm/swapfile.c | 175 ++++++++++++++++++++++++------------------- > 3 files changed, 109 insertions(+), 82 deletions(-) > > diff --git a/include/linux/swap.h b/include/linux/swap.h > index 5e1e4f5bf0cb..11c53692f65f 100644 > --- a/include/linux/swap.h > +++ b/include/linux/swap.h > @@ -268,13 +268,19 @@ struct swap_cluster_info { > */ > #define SWAP_NEXT_INVALID 0 > > +#ifdef CONFIG_THP_SWAP > +#define SWAP_NR_ORDERS (PMD_ORDER + 1) > +#else > +#define SWAP_NR_ORDERS 1 > +#endif > + > /* > * We assign a cluster to each CPU, so each CPU can allocate swap entry from > * its own cluster and swapout sequentially. The purpose is to optimize swapout > * throughput. > */ > struct percpu_cluster { > - unsigned int next; /* Likely next allocation offset */ > + unsigned int next[SWAP_NR_ORDERS]; /* Likely next allocation offset */ > }; > > struct swap_cluster_list { > @@ -471,7 +477,7 @@ swp_entry_t folio_alloc_swap(struct folio *folio); > bool folio_free_swap(struct folio *folio); > void put_swap_folio(struct folio *folio, swp_entry_t entry); > extern swp_entry_t get_swap_page_of_type(int); > -extern int get_swap_pages(int n, swp_entry_t swp_entries[], int entry_size); > +extern int get_swap_pages(int n, swp_entry_t swp_entries[], int order); > extern int add_swap_count_continuation(swp_entry_t, gfp_t); > extern void swap_shmem_alloc(swp_entry_t); > extern int swap_duplicate(swp_entry_t); > diff --git a/mm/swap_slots.c b/mm/swap_slots.c > index 53abeaf1371d..13ab3b771409 100644 > --- a/mm/swap_slots.c > +++ b/mm/swap_slots.c > @@ -264,7 +264,7 @@ static int refill_swap_slots_cache(struct swap_slots_cache *cache) > cache->cur = 0; > if (swap_slot_cache_active) > cache->nr = get_swap_pages(SWAP_SLOTS_CACHE_SIZE, > - cache->slots, 1); > + cache->slots, 0); > > return cache->nr; > } > @@ -311,7 +311,7 @@ swp_entry_t folio_alloc_swap(struct folio *folio) > > if (folio_test_large(folio)) { > if (IS_ENABLED(CONFIG_THP_SWAP)) > - get_swap_pages(1, &entry, folio_nr_pages(folio)); > + get_swap_pages(1, &entry, folio_order(folio)); The only comment I have is that this nr_pages -> order conversion adds a bit of noise to this patch. AFAIKS, it's primarily only required for "cluster->next[order]", everything else doesn't really require the order. I'd just have split that out into a separate patch, or simply converted nr_pages -> order where required. Nothing jumped at me, but I'm not an expert on that code, so I'm mostly trusting the others ;) -- Cheers, David / dhildenb