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 8CFE0C3DA49 for ; Tue, 23 Jul 2024 08:18:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0AC406B0098; Tue, 23 Jul 2024 04:18:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 034736B0096; Tue, 23 Jul 2024 04:18:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC9EB6B0098; Tue, 23 Jul 2024 04:18:46 -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 B34236B0095 for ; Tue, 23 Jul 2024 04:18:46 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 425F51A1BE2 for ; Tue, 23 Jul 2024 08:18:46 +0000 (UTC) X-FDA: 82370316252.28.BE35051 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf16.hostedemail.com (Postfix) with ESMTP id E7ABA180016 for ; Tue, 23 Jul 2024 08:18:43 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SY+vCyBi; spf=pass (imf16.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=1721722678; 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=e7cAW2e9eTq2PNCKhGWDYhlkj3Xk8nGIpFjirqjv88A=; b=8RYf5Z/JuWQkdqioemu2dHJzTW1mqKRO405H3QJhoid4IszH6+wUC5NSXo3QF+V/RDmtHe JPqF6UE0ozS1KSlFeliqquELtwUPiTtUCIetrhKRzngvOw7xEIsa+EB88/Jn7mmlCma1g+ 9aB1m0pxw8R/MIi451eYMusE992bjHE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721722678; a=rsa-sha256; cv=none; b=kU5im4NuA4LajrbIsf4SkKThdLSSmnjCnH+EpRwMAH9o/Mf/t1/9t/yjTIWrSGj0SjXm7T 5JzCvdVife3m5tHLqHfr8Uibw5zOUxewh9o14mgsqxVfARU91McECW9BH7NuN97UvdptKg QlESrYIt0EFt+SYsQbllxKkEJ3qm9d0= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=SY+vCyBi; spf=pass (imf16.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=1721722723; 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=e7cAW2e9eTq2PNCKhGWDYhlkj3Xk8nGIpFjirqjv88A=; b=SY+vCyBih68++XuOfZuju/LUfNt2eutuAzy/Zlp4wihmtXW+0uz5mX2czAgIiaoc4tV1Vn 9d0bJj6luD3qRjcinecFYR9AvM6GPNMigmkky/ApOqqQQlYfEWT64TKUlDxXA0I+dCL9My exBp0QOwP+dbUeVtdZnxI2ov90UbZa0= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-601-n2dumHTeNoi7pp_-D53PlQ-1; Tue, 23 Jul 2024 04:18:41 -0400 X-MC-Unique: n2dumHTeNoi7pp_-D53PlQ-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4279c75c44dso37369325e9.2 for ; Tue, 23 Jul 2024 01:18:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721722720; x=1722327520; 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=e7cAW2e9eTq2PNCKhGWDYhlkj3Xk8nGIpFjirqjv88A=; b=pOOHAR8oLgRS4ZO2Ypx8FunUTSfUYfeC79UBY3cs0J1mUkvJnchgytISImk5FsBEB7 Ccu1r5pp7UXx5+DWclh3T2hBNmlRWlfBNQA1bBURVR3sfm+6AhpJ8CLobsvpSQf7DW04 By2trm8vbny+lVauBgSgOxpPAlap7gvPNAeAunkPrcTE4dOt4N0stTqfu3yPJnxBxaQN W3/8SNYqvhKdNReySvL6oNL1GrlKWGQE/+sFRaZ/frw21SY7ntps984VCDBl14B7Qo0g e09v6u29/PN/mEeESgYflvi+vd12wRA4MSVzwOXZVdQh75GQTREFK/IND4lKZGKF0xoA AALg== X-Forwarded-Encrypted: i=1; AJvYcCVv3k3y8D7sQwpr9SGOEV4qDI3F3iKvoWwyq0c6Px6mAi22kYQtlqOIuKcrIqxWvKRM72Ra8A+rIQ6dHN+GI/RozDM= X-Gm-Message-State: AOJu0YxdF2omLkmPgHcTH5nj38skn6qrPEWAzKFSjw5JIXQjtjDJuzZq AtucqQhW/Oqt1EUbCJp177ESVD/LHolimMHlDJG6eQoBI6ni21K/8fYNw2a6vMtvIvRyUiSrWYr jSPS9hYfL/BEkSJaUfrA4A4+f/D8ZXWuY1sdCrI64QCpwt1x0 X-Received: by 2002:a05:600c:500f:b0:426:6326:4cec with SMTP id 5b1f17b1804b1-427df7a7828mr59110105e9.29.1721722720310; Tue, 23 Jul 2024 01:18:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUWHnl+IF1Uo0ddKTvKJTZa1BJHPgCl9dGzav/h00NQB9OiTQfs5h5kD6cvqR3xzQXjLrG9w== X-Received: by 2002:a05:600c:500f:b0:426:6326:4cec with SMTP id 5b1f17b1804b1-427df7a7828mr59109795e9.29.1721722719834; Tue, 23 Jul 2024 01:18:39 -0700 (PDT) Received: from ?IPV6:2003:cb:c72f:ed00:9dc2:1adb:d133:4434? (p200300cbc72fed009dc21adbd1334434.dip0.t-ipconnect.de. [2003:cb:c72f:ed00:9dc2:1adb:d133:4434]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427d6929827sm160330615e9.34.2024.07.23.01.18.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Jul 2024 01:18:39 -0700 (PDT) Message-ID: Date: Tue, 23 Jul 2024 10:18:37 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC 0/6] mm: THP-agnostic refactor on huge mappings To: Peter Xu Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Vlastimil Babka , Oscar Salvador , linux-s390@vger.kernel.org, Andrew Morton , Matthew Wilcox , Dan Williams , Michal Hocko , linux-riscv@lists.infradead.org, sparclinux@vger.kernel.org, Alex Williamson , Jason Gunthorpe , x86@kernel.org, Alistair Popple , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Ryan Roberts , Hugh Dickins , Axel Rasmussen References: <20240717220219.3743374-1-peterx@redhat.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/Z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f4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3 AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+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: 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: E7ABA180016 X-Stat-Signature: xzd9uuia1dmi9chsc57ci87165m4dj3c X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-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+s5farVJ/VXVF2KPgNTBJXEfSTMJa7VGj0vS9yZA5OR+n7dgDgOGjp3fYlfDUVohAxoE4eaZZdmWqZG7/qRw++ddPMwyXB/SYuBagiF5lohSwe4cmBFYTNvpeQZ29xsrpln8CG74aTZceqRMlYJoldOZc0e00zFX3O4+1eOdN/ZU+JKhLK2qYEwDHiPPlr+5tdyEpAj3YEyo/uPXTE5XsfnW7p/hVY2v5BPFA8Qp5bWVNKNo2+Xa+LyHSumQdghtKpm0QC7PBXLA3iQVKXP+bmeEe43J089nRFmu/+qQH55HtTSOlwo1d5ixCKhoSxhL9zW0eB0tlLpQM3mhE8kO/KRf5OxABrsmv7570pOO/E0woscIjCKWx0cB1wB+qH5H6UegRiMZjw= 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 22.07.24 17:31, Peter Xu wrote: > On Mon, Jul 22, 2024 at 03:29:43PM +0200, David Hildenbrand wrote: >> On 18.07.24 00:02, Peter Xu wrote: >>> This is an RFC series, so not yet for merging. Please don't be scared by >>> the code changes: most of them are code movements only. >>> >>> This series is based on the dax mprotect fix series here (while that one is >>> based on mm-unstable): >>> >>> [PATCH v3 0/8] mm/mprotect: Fix dax puds >>> https://lore.kernel.org/r/20240715192142.3241557-1-peterx@redhat.com >>> >>> Overview >>> ======== >>> >>> This series doesn't provide any feature change. The only goal of this >>> series is to start decoupling two ideas: "THP" and "huge mapping". We >>> already started with having PGTABLE_HAS_HUGE_LEAVES config option, and this >>> one extends that idea into the code. >>> >>> The issue is that we have so many functions that only compile with >>> CONFIG_THP=on, even though they're about huge mappings, and huge mapping is >>> a pretty common concept, which can apply to many things besides THPs >>> nowadays. The major THP file is mm/huge_memory.c as of now. >>> >>> The first example of such huge mapping users will be hugetlb. We lived >>> until now with no problem simply because Linux almost duplicated all the >>> logics there in the "THP" files into hugetlb APIs. If we want to get rid >>> of hugetlb specific APIs and paths, this _might_ be the first thing we want >>> to do, because we want to be able to e.g., zapping a hugetlb pmd entry even >>> if !CONFIG_THP. >>> >>> Then consider other things like dax / pfnmaps. Dax can depend on THP, then >>> it'll naturally be able to use pmd/pud helpers, that's okay. However is it >>> a must? Do we also want to have every new pmd/pud mappings in the future >>> to depend on THP (like PFNMAP)? My answer is no, but I'm open to opinions. >>> >>> If anyone agrees with me that "huge mapping" (aka, PMD/PUD mappings that >>> are larger than PAGE_SIZE) is a more generic concept than THP, then I think >>> at some point we need to move the generic code out of THP code into a >>> common code base. >>> >>> This is what this series does as a start. >> >> Hi Peter! >> >> From a quick glimpse, patch #1-#4 do make sense independent of patch #5. >> >> I am not so sure about all of the code movement in patch #5. If large folios >> are the future, then likely huge_memory.c should simply be the home for all >> that logic. >> >> Maybe the goal should better be to compile huge_memory.c not only for THP, >> but also for other use cases that require that logic, and fence off all THP >> specific stuff using #ifdef? >> >> Not sure, though. But a lot of this code movements/churn might be avoidable. > > I'm fine using ifdefs in the current fine, but IMHO it's a matter of > whether we want to keep huge_memory.c growing into even larger file, and > keep all large folio logics only in that file. Currently it's ~4000 LOCs. Depends on "how much" for sure. huge_memory.c is currently on place 12 of the biggest files in mm/. So there might not be immediate cause for action ... just yet :) [guess which file is on #2 :) ] > > Nornally I don't see this as much of a "code churn" category, because it > doesn't changes the code itself but only move things. I personally also > prefer without code churns, but only in the case where there'll be tiny > little functional changes here and there without real benefit. > > It's pretty unavoidable to me when one file grows too large and we'll need > to split, and in this case git doesn't have a good way to track such > movement.. Yes, that's what I mean. I've been recently thinking if we should pursue a different direction: Just as we recently relocated most follow_huge_* stuff into gup.c, likely we should rather look into moving copy_huge_pmd, change_huge_pmd, copy_huge_pmd ... into the files where they logically belong to. In madvise.c, we've been doing that in some places already: For madvise_cold_or_pageout_pte_range() we inline the code, but not for madvise_free_huge_pmd(). pmd_trans_huge() would already compile to a NOP without CONFIG_TRANSPARENT_HUGEPAGE, but to make that code avoid most CONFIG_TRANSPARENT_HUGEPAGE, we'd need a couple more function stubs to make the compiler happy while still being able to compile that code out when not required. The idea would be that e.g., pmd_leaf() would return "false" at compile time if no active configuration (THP, HUGETLB, ...) would be active. So we could just use pmd_leaf() similar to pmd_trans_huge() in relevant code and have the compiler optimize it all out without putting it into separate files. That means, large folios and PMD/PUD mappings will become "more common" and better integrated, without the need to jump between files. Just some thought about an alternative that would make sense to me. > > Irrelevant of this, just to mention I think there's still one option that I > at least can make the huge pfnmap depends on THP again which shouldn't be a > huge deal (I don't have any use case that needs huge pfnmap but disable > THP, anyway..), so this series isn't an immediate concern to me for that > route. But for a hugetlb rework this might be something we need to do, > because we simplly can't make CONFIG_HUGETLB rely on CONFIG_THP.. Yes, likely. FSDAX went a similar direction and called that FSDAX thing a "THP" whereby it really doesn't have anything in common with a THP, besides being partially mappable -- IMHO. -- Cheers, David / dhildenb