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 E242BC3271E for ; Mon, 8 Jul 2024 08:18:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2DAE86B009B; Mon, 8 Jul 2024 04:18:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 28AE76B009F; Mon, 8 Jul 2024 04:18:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 105096B00A0; Mon, 8 Jul 2024 04:18:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E04266B009B for ; Mon, 8 Jul 2024 04:18:37 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 99E55A11F5 for ; Mon, 8 Jul 2024 08:18:37 +0000 (UTC) X-FDA: 82315883874.15.EEA1010 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf23.hostedemail.com (Postfix) with ESMTP id 590CE140002 for ; Mon, 8 Jul 2024 08:18:35 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=hWWc+BSU; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=M0y01MZQ; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=hWWc+BSU; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=M0y01MZQ; spf=pass (imf23.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720426700; a=rsa-sha256; cv=none; b=wtfKTkK8MJ4lHUNV11PFZc8ypGHzqEA9cX0JGo7YKysnkuQRzxIHXi4R22V7LRuGHeqvwd HJV+bn26sLfV8XTpE5nBMHyRpDC/eOMGxyaSzaU3mgoB6mcb8s6buE4Gua8N5mFHJLP4x0 Bl6ttoE7HmGcYQbP4mmpA+4+0eFzmHM= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=hWWc+BSU; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=M0y01MZQ; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=hWWc+BSU; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=M0y01MZQ; spf=pass (imf23.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720426700; 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=/Ihnjih6wKrKAooD4HKYfrrl0oRcgj0cWYHWi7AhdIQ=; b=DkJ2RMwuMiMxMkT/9iEzZ9rXjxCe5B40qn/p40MMzSJHuUxZhe/TSP0XaN5uNYDp1B5j94 +GxR1+wPQP8m4fV098vIqJvkQEO4trtgBIZ5KKS4GYvt/UiHJTAZrEr3d3dHXWaMAA+UdJ rpmpPWeuBBW0myrY4G9Nn0vSSVBEVMk= Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7900F1FC04; Mon, 8 Jul 2024 08:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1720426713; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/Ihnjih6wKrKAooD4HKYfrrl0oRcgj0cWYHWi7AhdIQ=; b=hWWc+BSUSy3QLdZqku9vup8XAhaKyrq0QMyVJ/aXXdJTRNQJVzrbiz900jE2njtDD85W8E tXMYC9sFK8F0FNihzcdeu472TVMx0yXqKc9AvPrffhU/U6+Qvp/Gp5iVFK054DybTVxK6G BMmyTiZvYZ+/qa7N4XYFL3nM63/1mTg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1720426713; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/Ihnjih6wKrKAooD4HKYfrrl0oRcgj0cWYHWi7AhdIQ=; b=M0y01MZQbMM3pZJwZ6GHdoxAuInPYUXACb13d8Z6m1MZ9PuyKJSrIu6YO/zzVWD4eiic6p 456Rm67bzI5m+RDQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1720426713; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/Ihnjih6wKrKAooD4HKYfrrl0oRcgj0cWYHWi7AhdIQ=; b=hWWc+BSUSy3QLdZqku9vup8XAhaKyrq0QMyVJ/aXXdJTRNQJVzrbiz900jE2njtDD85W8E tXMYC9sFK8F0FNihzcdeu472TVMx0yXqKc9AvPrffhU/U6+Qvp/Gp5iVFK054DybTVxK6G BMmyTiZvYZ+/qa7N4XYFL3nM63/1mTg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1720426713; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/Ihnjih6wKrKAooD4HKYfrrl0oRcgj0cWYHWi7AhdIQ=; b=M0y01MZQbMM3pZJwZ6GHdoxAuInPYUXACb13d8Z6m1MZ9PuyKJSrIu6YO/zzVWD4eiic6p 456Rm67bzI5m+RDQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 59EFA13A7F; Mon, 8 Jul 2024 08:18:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Et83Edigi2aeHgAAD6G6ig (envelope-from ); Mon, 08 Jul 2024 08:18:32 +0000 Date: Mon, 8 Jul 2024 10:18:30 +0200 From: Oscar Salvador To: David Hildenbrand Cc: Peter Xu , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Muchun Song , SeongJae Park , Miaohe Lin , Michal Hocko , Matthew Wilcox , Christophe Leroy , Jason Gunthorpe Subject: Re: [PATCH 00/45] hugetlb pagewalk unification Message-ID: References: <20240704043132.28501-1-osalvador@suse.de> <617169bc-e18c-40fa-be3a-99c118a6d7fe@redhat.com> <84d4e799-90da-487e-adba-6174096283b5@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <84d4e799-90da-487e-adba-6174096283b5@redhat.com> X-Stat-Signature: 5cg3qmz9j1d1soka3iimx8rqefkj9rey X-Rspamd-Queue-Id: 590CE140002 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1720426715-605347 X-HE-Meta: U2FsdGVkX18ItFYSB4177ww/wJQS6YiVOwRF0s0+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TZfhD9Dx73LkUZt5SLtWv6laZ3i5BGHI6lWla2maVfBcbsIpEemcIK+fBWD/O9PJ3x0+lenmM43jpJ5ZRQO+/OUcvcRPgiVtlKzKmhAV+unEjzsw/CbQ== 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 Thu, Jul 04, 2024 at 05:23:30PM +0200, David Hildenbrand wrote: > My thinking was if "remove hugetlb_entry" cannot wait for "remove > page_walk", because we found a reasonable way to do it better and convert > the individual users. Maybe it can't. > > I've not given up hope that we can end up with something better and clearer > than the current page_walk API :) Hi David, I agree that the current page_walk might be a bit convoluted, and that the indirect functions approach is a bit of a hassle. Having said that, let me clarify something. Although this patchset touches the page_walk API wrt. getting rid of hugetlb special casing all over the place, my goal was not as focused on the page_walk as it was on the hugetlb code to gain hability to be interpreted on PUD/PMD level. One of the things, among other things, that helped in creating this mess/duplication we have wrt. hugetlb code vs mm core is that hugetlb __always__ operates on ptes, which means that we cannot rely on the mm core to do the right thing, and we need a bunch of hugetlb-pte functions that knows about their thing, so we lean on that. IMHO, that was a mistake to start with, but I was not around when it was introduced and maybe there were good reasons to deal with that the way it is done. But, the thing is that my ultimate goal, is for hugetlb code to be able to deal with PUD/PMD (pte and cont-pte is already dealt with) just like mm core does for THP (PUD is not supported by THP, but you get me), and that is not that difficult to do, as this patchset tries to prove. Of course, for hugetlb to gain the hability to operate on PUD/PMD, this means we need to add a fairly amount of code. e.g: for operating hugepages on PUD level, code for markers on PUD/PMD level for uffd/poison stuff (only dealt on pmd/pte atm AFAIK), swap functions for PUD (is_swap_pud for PUD), etc. Basically, almost all we did for PMD-* stuff we need it for PUD as well, and that will be around when THP gains support for PUD if it ever does (I guess that in a few years if memory capacity keeps increasing). E.g: pud_to_swp_entry to detect that a swp entry is hwpoison with is_hwpoison_entry Yes, it is a hassle to have more code around, but IMO, this new code will help us in 1) move away from __always__ operate on ptes 2) ease integrate hugetlb code into mm core. I will keep working on this patchset not because of pagewalk savings, but because I think it will help us in have hugetlb more mm-core ready, since the current pagewalk has to test that a hugetlb page can be properly read on PUD/PMD/PTE level no matter what: uffd for hugetlb on PUD/PMD, hwpoison entries for swp on PUD/PMD, pud invalidating, etc. If that gets accomplished, I think that a fair amount of code that lives in hugetlb.c can be deleted/converted as less special casing will be needed. I might be wrong and maybe I will hit a brick wall, but hopefully not. -- Oscar Salvador SUSE Labs